コード例 #1
0
 public function check(Request $request, TokenAuth $tokenAuth)
 {
     if (!$request->get('JWT')) {
         $responder = new Responder\Responder();
         return $responder->respond(function ($response) {
             $response->fails = true;
             $response->messages[] = ['auth' => 'No token'];
             return $response;
         });
     }
     $response = $tokenAuth->validate($request->get('JWT'));
     $response->user = \App\User::with('categories')->where('id', '=', $request->get('userId'))->first();
     return \Response::json($response);
 }
コード例 #2
0
ファイル: Responder.php プロジェクト: amanos1022/mispots_api
 public function tokenValidateAndRespond($request, $rules, $call = null)
 {
     if (TokenAuth::fails($request)) {
         $this->response->fails = true;
         $this->response->messages = ['Auth', 'Please Login.'];
         return \Response::json($this->response, 400);
     } else {
         return $this->validateAndRespond($request, $rules, $call);
     }
 }