Пример #1
0
 /**
  * @param  User                 $user
  * @return \Tymon\JWTAuth\Token
  */
 public function generateTokenFromUser(User $user)
 {
     /** @var Payload $payload */
     $payload = $this->jwtManager->getPayloadFactory()->sub($user->getId())->make();
     $token = $this->jwtManager->encode($payload);
     return $token;
 }
Пример #2
0
 public function transform(User $user)
 {
     return ['id' => $user->getId()];
 }