response.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/laravel-response.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. return [
  11. /*
  12. |--------------------------------------------------------------------------
  13. | Set the http status code when the response fails
  14. |--------------------------------------------------------------------------
  15. |
  16. | the reference options are false, 200, 500
  17. |
  18. | false, stricter http status codes such as 404, 401, 403, 500, etc. will be returned
  19. | 200, All failed responses will also return a 200 status code
  20. | 500, All failed responses return a 500 status code
  21. */
  22. 'error_code' => false,
  23. // Set the http status code returned when the form validation fails.
  24. // When the error_code is set to 200 or 500, it will not work
  25. 'validation_error_code' => 422,
  26. // Set the structure of the paging data return,the following structure will be returned by default,
  27. // You can modify the name of the inner data field through the following configuration items, such as rows or list
  28. //{
  29. // "status": "success",
  30. // "code": 200,
  31. // "message": "Success.",
  32. // "data": {
  33. // "data": [
  34. // // ...
  35. // ],
  36. // "meta": {
  37. // // ...
  38. // }
  39. // },
  40. // "error": {}
  41. //}
  42. 'format' => [
  43. 'paginated_resource' => [
  44. 'data_field' => 'data',
  45. ],
  46. ],
  47. // You can use enumerations to define the code when the response is returned,
  48. // and set the response message according to the locale
  49. //
  50. // The following two enumeration packages are good choices
  51. //
  52. // https://github.com/Jiannei/laravel-enum
  53. // https://github.com/BenSampo/laravel-enum
  54. 'enum' => '', // \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::class
  55. ];