flush() public method

Flushes persistences for the given user.
public flush ( Cartalyst\Sentinel\Persistences\PersistableInterface $persistable, boolean $forget = true ) : void
$persistable Cartalyst\Sentinel\Persistences\PersistableInterface
$forget boolean
return void
Esempio n. 1
0
 /**
  * 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);
 }