where("name", $name); if ($group->loaded) { throw new Exception("@todo GROUP_ALREADY_EXISTS $name"); } $group->name = $name; $group->save(); module::event("group_created", $group); return $group; } /** * The group of all possible visitors. This includes the guest user. * * @todo consider caching * * @return Group_Model */ static function everybody() { return ORM::factory("group", 1); } /** * The group of all logged-in visitors. This does not include guest users. * * @todo consider caching * * @return Group_Model */ static function registered_users() { return ORM::factory("group", 2); } }