예제 #1
0
 public static function current()
 {
     if ($user = parent::current()) {
         if ($user->hasPanelAccess()) {
             return $user;
         } else {
             $user->logout();
             return null;
         }
     } else {
         return null;
     }
 }
예제 #2
0
 public function user($username = null)
 {
     if (is_null($username)) {
         return User::current();
     }
     try {
         return new User($username);
     } catch (Exception $e) {
         return null;
     }
 }