1 | <?php |
||
8 | class Controller extends BaseController |
||
9 | { |
||
10 | /** |
||
11 | * @var int |
||
12 | */ |
||
13 | protected $statusCode = Response::HTTP_OK; |
||
14 | |||
15 | public function setStatusCode(int $statusCode) |
||
21 | |||
22 | public function getStatusCode(): int |
||
26 | |||
27 | /** |
||
28 | * Send a response with a internal server error code. |
||
29 | * |
||
30 | * @param string $message |
||
31 | * |
||
32 | * @return \Illuminate\Http\Response |
||
33 | */ |
||
34 | public function respondWithInternalServerError($message = 'Internal Server Error') |
||
40 | |||
41 | /** |
||
42 | * Send a response with a bad request. |
||
43 | * |
||
44 | * @param string $message |
||
45 | * |
||
46 | * @return \Illuminate\Http\Response |
||
47 | */ |
||
48 | public function respondWithBadRequest($message = 'Bad Request') |
||
54 | |||
55 | /** |
||
56 | * Set a response. |
||
57 | * |
||
58 | * @param array $data |
||
59 | * @param array $headers |
||
60 | * |
||
61 | * @return \Illuminate\Http\JsonResponse |
||
62 | */ |
||
63 | public function respond(array $data, array $headers = []) |
||
67 | |||
68 | /** |
||
69 | * Respond with an error message. |
||
70 | * |
||
71 | * @param string $message |
||
72 | * |
||
73 | * @return \Illuminate\Http\JsonResponse |
||
74 | */ |
||
75 | public function respondWithError($message) |
||
84 | } |
||
85 |