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