コード例 #1
0
ファイル: JWTGuard.php プロジェクト: a161527/cs319-p2t5
 /**
  * Get the currently authenticated user.
  *
  * @return \Illuminate\Contracts\Auth\Authenticatable|null
  */
 public function user()
 {
     if ($this->user !== null) {
         return $this->user;
     }
     if ($this->jwt->getToken() && $this->jwt->check()) {
         $id = $this->jwt->payload()->get('sub');
         return $this->user = $this->provider->retrieveById($id);
     }
 }