/** * Get the currently authenticated user. * * @return \Illuminate\Contracts\Auth\Authenticatable|null */ public function user() { if (!is_null($this->user)) { return $this->user; } if (!$this->requireToken()->check()) { return null; } $id = $this->jwt->getPayload()->get('sub'); return $this->user = $this->provider->retrieveById($id); }
/** * Get the raw Payload instance. * * @return \Tymon\JWTAuth\Payload */ public function getPayload() { return $this->jwt->getPayload(); }