| @@ 47-55 (lines=9) @@ | ||
| 44 | } |
|
| 45 | ||
| 46 | switch ($this->responseCode) { |
|
| 47 | case 400: |
|
| 48 | return response()->json( |
|
| 49 | [ |
|
| 50 | 'error' => [ |
|
| 51 | 'code' => $this->statusCode, |
|
| 52 | 'message' => 'Unprocessable Entity' |
|
| 53 | ]], |
|
| 54 | $this->responseCode |
|
| 55 | ); |
|
| 56 | case 401: |
|
| 57 | return response()->json( |
|
| 58 | [ |
|
| @@ 56-64 (lines=9) @@ | ||
| 53 | ]], |
|
| 54 | $this->responseCode |
|
| 55 | ); |
|
| 56 | case 401: |
|
| 57 | return response()->json( |
|
| 58 | [ |
|
| 59 | 'error' => [ |
|
| 60 | 'code' => $this->statusCode, |
|
| 61 | 'message' => 'Authentication credentials were missing or incorrect' |
|
| 62 | ]], |
|
| 63 | $this->responseCode |
|
| 64 | ); |
|
| 65 | case 403: |
|
| 66 | return response()->json( |
|
| 67 | [ |
|
| @@ 65-73 (lines=9) @@ | ||
| 62 | ]], |
|
| 63 | $this->responseCode |
|
| 64 | ); |
|
| 65 | case 403: |
|
| 66 | return response()->json( |
|
| 67 | [ |
|
| 68 | 'error' => [ |
|
| 69 | 'code' => $this->statusCode, |
|
| 70 | 'message' => 'Forbidden' |
|
| 71 | ]], |
|
| 72 | $this->responseCode |
|
| 73 | ); |
|
| 74 | case 404: |
|
| 75 | return response()->json( |
|
| 76 | [ |
|
| @@ 74-82 (lines=9) @@ | ||
| 71 | ]], |
|
| 72 | $this->responseCode |
|
| 73 | ); |
|
| 74 | case 404: |
|
| 75 | return response()->json( |
|
| 76 | [ |
|
| 77 | 'error' => [ |
|
| 78 | 'code' => $this->statusCode, |
|
| 79 | 'message' => 'Not Found' |
|
| 80 | ]], |
|
| 81 | $this->responseCode |
|
| 82 | ); |
|
| 83 | case 405: |
|
| 84 | return response()->json( |
|
| 85 | [ |
|
| @@ 83-91 (lines=9) @@ | ||
| 80 | ]], |
|
| 81 | $this->responseCode |
|
| 82 | ); |
|
| 83 | case 405: |
|
| 84 | return response()->json( |
|
| 85 | [ |
|
| 86 | 'error' => [ |
|
| 87 | 'code' => $this->statusCode, |
|
| 88 | 'message' => 'Method Not Allowed' |
|
| 89 | ]], |
|
| 90 | $this->responseCode |
|
| 91 | ); |
|
| 92 | default: |
|
| 93 | return response()->json( |
|
| 94 | [ |
|
| @@ 92-100 (lines=9) @@ | ||
| 89 | ]], |
|
| 90 | $this->responseCode |
|
| 91 | ); |
|
| 92 | default: |
|
| 93 | return response()->json( |
|
| 94 | [ |
|
| 95 | 'error' => [ |
|
| 96 | 'code' => $this->statusCode, |
|
| 97 | 'message' => 'Internal Server Error' |
|
| 98 | ]], |
|
| 99 | 500 |
|
| 100 | ); |
|
| 101 | } |
|
| 102 | } |
|
| 103 | ||