/** * @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; }
public function transform(User $user) { return ['id' => $user->getId()]; }