| 1 | <?php namespace Arcanedev\LaravelApiHelper\Traits; |
||
| 11 | trait JsonResponses |
||
| 12 | { |
||
| 13 | /* ----------------------------------------------------------------- |
||
| 14 | | Main Methods |
||
| 15 | | ----------------------------------------------------------------- |
||
| 16 | */ |
||
| 17 | /** |
||
| 18 | * Get the json response instance. |
||
| 19 | * |
||
| 20 | * @return \Arcanedev\LaravelApiHelper\Contracts\Http\JsonResponse |
||
| 21 | */ |
||
| 22 | 9 | public function jsonResponse() |
|
| 26 | |||
| 27 | /** |
||
| 28 | * Respond with a success response. |
||
| 29 | * |
||
| 30 | * @param array|mixed $data |
||
| 31 | * @param int $code |
||
| 32 | * @param array $headers |
||
| 33 | * @param int $options |
||
| 34 | * |
||
| 35 | * @return \Illuminate\Http\JsonResponse |
||
| 36 | */ |
||
| 37 | 6 | public function jsonResponseSuccess($data, $code = 200, array $headers = [], $options = 0) |
|
| 41 | |||
| 42 | /** |
||
| 43 | * Respond with an error response. |
||
| 44 | * |
||
| 45 | * @param string $message |
||
| 46 | * @param int $code |
||
| 47 | * @param array $headers |
||
| 48 | * @param int $options |
||
| 49 | * |
||
| 50 | * @return \Illuminate\Http\JsonResponse |
||
| 51 | */ |
||
| 52 | 3 | public function jsonResponseError($message, $code = 400, array $headers = [], $options = 0) |
|
| 56 | } |
||
| 57 |