JWTAuth::setToken PHP Method

setToken() public static method

Set the token.
public static setToken ( string $token )
$token string
        public static function setToken($token)
        {
            return \Tymon\JWTAuth\JWTAuth::setToken($token);
        }

Usage Example

コード例 #1
1
 /**
  * @param \App\User $user
  */
 protected function headers($user = null)
 {
     $headers = ['Accept' => 'application/json'];
     if (!is_null($user)) {
         $token = JWTAuth::fromUser($user);
         JWTAuth::setToken($token);
         $headers['HTTP_AUTHORIZATION'] = 'Bearer ' . (string) $token;
     }
     return $headers;
 }
All Usage Examples Of JWTAuth::setToken