Owl\Services\UserService::getByToken PHP Метод

getByToken() публичный Метод

Get a user by login token.
public getByToken ( string $token ) : stdclass
$token string
Результат stdclass | bool
    public function getByToken($token)
    {
        $TWO_WEEKS = 14;
        $limit = Carbon::now()->subDays($TWO_WEEKS);
        $tokenResult = $this->loginTokenRepo->getValidLoginToken($token, $limit);
        if (isset($tokenResult)) {
            $user = $this->getById($tokenResult->user_id);
            return $user;
        } else {
            return false;
        }
    }

Usage Example

Пример #1
0
 /**
  * Retrieve a user by unique token and identifier.
  *
  * @param mixed   $identifier
  * @param string  $token
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable|null
  */
 public function retrieveByToken($identifier, $token)
 {
     $user = $this->userService->getByToken($token);
     if (!$user) {
         return null;
     }
     return $this->getOwlUser($user);
 }
All Usage Examples Of Owl\Services\UserService::getByToken