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