예제 #1
0
 protected function retrieve($id)
 {
     if (!isset($this->retrieved[$id])) {
         $this->retrieved[$id] = $group = Group::find($id);
         if (is_null($group)) {
             return;
         }
         $this->loadPermissions($group);
     }
     return $this->retrieved[$id];
 }
예제 #2
0
 public function admin($arguments = array())
 {
     if (count($arguments) != 3) {
         throw new BadMethodCallException('Exactly three arguments expected.');
     }
     $username = $arguments[0];
     $password = $arguments[1];
     $email = $arguments[2];
     // Create admin user
     $admin_user = User::create(array('username' => $username, 'password' => $password, 'email' => $email, 'language' => Laravel\Config::get('application.language'), 'style' => 'Air', 'last_post' => Request::time(), 'registered' => Request::time(), 'registration_ip' => Request::ip(), 'last_visit' => Request::time()));
     $admin_group = Group::find(Group::ADMIN);
     if (is_null($admin_group)) {
         throw new LogicException('Could not find admin group.');
     }
     $admin_group->users()->insert($admin_user);
 }