コード例 #1
0
 /**
  * @param $id
  * @return \Illuminate\Http\JsonResponse
  */
 public function showModalidades($id)
 {
     try {
         $convocatoria = Convocatoria::with('Modalidad')->find($id);
         if ($convocatoria != null) {
             return response()->json($convocatoria->Modalidad);
         }
         return response()->json(['message' => 'convocatoria_not_found'], 404);
     } catch (QueryException $e) {
         return response()->json(['message' => 'server_error', 'exception' => $e->getMessage()], 500);
     } catch (Exceptions\TokenExpiredException $e) {
         return response()->json(['token_expired'], $e->getStatusCode());
     } catch (Exceptions\TokenInvalidException $e) {
         return response()->json(['token_invalid'], $e->getStatusCode());
     } catch (UnauthorizedException $e) {
         return response()->json(['unauthorized'], $e->getStatusCode());
     } catch (Exceptions\JWTException $e) {
         return response()->json(['token_absent'], $e->getStatusCode());
     }
 }