Records a logout for the given user.
public recordLogout ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean | ||
$user | Cartalyst\Sentinel\Users\UserInterface | |
리턴 | Cartalyst\Sentinel\Users\UserInterface | boolean |
/** * 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); }
/** * 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); }