Flarum\Http\Rememberer::rememberUser PHP Method

rememberUser() public method

public rememberUser ( Psr\Http\Message\ResponseInterface $response, $userId )
$response Psr\Http\Message\ResponseInterface
    public function rememberUser(ResponseInterface $response, $userId)
    {
        $token = AccessToken::generate($userId);
        return $this->remember($response, $token);
    }

Usage Example

 public function make(Request $request, array $identification, array $suggestions = [])
 {
     if (isset($suggestions['username'])) {
         $suggestions['username'] = $this->sanitizeUsername($suggestions['username']);
     }
     $user = User::where($identification)->first();
     $payload = $this->getPayload($identification, $suggestions, $user);
     $response = $this->getResponse($payload);
     if ($user) {
         $session = $request->getAttribute('session');
         $this->authenticator->logIn($session, $user->id);
         $response = $this->rememberer->rememberUser($response, $user->id);
     }
     return $response;
 }
All Usage Examples Of Flarum\Http\Rememberer::rememberUser