Cartalyst\Sentinel\Users\UserRepositoryInterface::recordLogin PHP Method

recordLogin() public method

Records a login for the given user.
public recordLogin ( Cartalyst\Sentinel\Users\UserInterface $user ) : Cartalyst\Sentinel\Users\UserInterface | boolean
$user Cartalyst\Sentinel\Users\UserInterface
return Cartalyst\Sentinel\Users\UserInterface | boolean
    public function recordLogin(UserInterface $user);

Usage Example

Beispiel #1
0
 /**
  * Persists a login for the given user.
  *
  * @param  \Cartalyst\Sentinel\Users\UserInterface  $user
  * @param  bool  $remember
  * @return \Cartalyst\Sentinel\Users\UserInterface|bool
  */
 public function login(UserInterface $user, $remember = false)
 {
     $method = $remember === true ? 'persistAndRemember' : 'persist';
     $this->persistences->{$method}($user);
     $response = $this->users->recordLogin($user);
     if ($response === false) {
         return false;
     }
     return $this->user = $user;
 }