recordLogout() public method

Records a logout for the given user.
public recordLogout ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
return Cartalyst\Sentinel\Users\UserInterface | boolean
コード例 #1
0
ファイル: Sentinel.php プロジェクト: sohailaammarocs/lfc
 /**
  * Logs the current user out.
  *
  * @param  \Cartalyst\Sentinel\Users\UserInterface  $user
  * @param  bool  $everywhere
  * @return bool
  */
 public function logout(UserInterface $user = null, $everywhere = false)
 {
     $user = $user ?: $this->getUser();
     if ($user === null) {
         return true;
     }
     $method = $everywhere === true ? 'flush' : 'forget';
     $this->persistences->{$method}($user);
     return $this->users->recordLogout($user);
 }
コード例 #2
0
ファイル: Sentinel.php プロジェクト: incube8/sentinel
 /**
  * Logs the current user out.
  *
  * @param  \Cartalyst\Sentinel\Users\UserInterface  $user
  * @param  bool  $everywhere
  * @return bool
  */
 public function logout(UserInterface $user = null, $everywhere = false)
 {
     $currentUser = $this->check();
     if ($user && $user !== $currentUser) {
         $this->persistences->flush($user, false);
         return true;
     }
     $user = $user ?: $currentUser;
     if ($user === false) {
         return true;
     }
     $method = $everywhere === true ? 'flush' : 'forget';
     $this->persistences->{$method}($user);
     $this->user = null;
     return $this->users->recordLogout($user);
 }