|
12 | 12 | */ |
13 | 13 |
|
14 | 14 | return [ |
15 | | - /* |
16 | | - |----------------------------------------------------------------------------------------------------------- |
17 | | - | Code range settings |
18 | | - |----------------------------------------------------------------------------------------------------------- |
19 | | - */ |
20 | | - 'min_code' => 100, |
21 | | - 'max_code' => 1024, |
| 15 | + /* |
| 16 | + |----------------------------------------------------------------------------------------------------------- |
| 17 | + | Code range settings |
| 18 | + |----------------------------------------------------------------------------------------------------------- |
| 19 | + */ |
| 20 | + 'min_code' => 100, |
| 21 | + 'max_code' => 1024, |
22 | 22 |
|
23 | | - /* |
24 | | - |----------------------------------------------------------------------------------------------------------- |
25 | | - | Error code to message mapping |
26 | | - |----------------------------------------------------------------------------------------------------------- |
27 | | - | |
28 | | - */ |
29 | | - 'map' => [ |
| 23 | + /* |
| 24 | + |----------------------------------------------------------------------------------------------------------- |
| 25 | + | Error code to message mapping |
| 26 | + |----------------------------------------------------------------------------------------------------------- |
| 27 | + | |
| 28 | + */ |
| 29 | + 'map' => [ |
30 | 30 |
|
31 | | - ], |
| 31 | + ], |
32 | 32 |
|
33 | | - /* |
34 | | - |----------------------------------------------------------------------------------------------------------- |
35 | | - | Response Builder classes |
36 | | - |----------------------------------------------------------------------------------------------------------- |
37 | | - | |
38 | | - */ |
39 | | - 'classes' => [ |
40 | | - \Illuminate\Database\Eloquent\Model::class => [ |
41 | | - 'key' => 'item', |
42 | | - 'method' => 'toArray', |
43 | | - ], |
44 | | - \Illuminate\Support\Collection::class => [ |
45 | | - 'key' => 'items', |
46 | | - 'method' => 'toArray', |
47 | | - ], |
48 | | - \Illuminate\Database\Eloquent\Collection::class => [ |
49 | | - 'key' => 'items', |
50 | | - 'method' => 'toArray', |
51 | | - ], |
52 | | - \Illuminate\Http\Resources\Json\JsonResource::class => [ |
53 | | - 'key' => 'item', |
54 | | - 'method' => 'toArray', |
55 | | - ], |
56 | | - ], |
| 33 | + /* |
| 34 | + |----------------------------------------------------------------------------------------------------------- |
| 35 | + | Response Builder classes |
| 36 | + |----------------------------------------------------------------------------------------------------------- |
| 37 | + | |
| 38 | + */ |
| 39 | + 'classes' => [ |
| 40 | + \Illuminate\Database\Eloquent\Model::class => [ |
| 41 | + 'key' => 'item', |
| 42 | + 'method' => 'toArray', |
| 43 | + 'pri' => 0, |
| 44 | + ], |
| 45 | + \Illuminate\Support\Collection::class => [ |
| 46 | + 'key' => 'items', |
| 47 | + 'method' => 'toArray', |
| 48 | + 'pri' => -1, |
| 49 | + ], |
| 50 | + \Illuminate\Database\Eloquent\Collection::class => [ |
| 51 | + 'key' => 'items', |
| 52 | + 'method' => 'toArray', |
| 53 | + 'pri' => 0, |
| 54 | + ], |
| 55 | + \Illuminate\Http\Resources\Json\JsonResource::class => [ |
| 56 | + 'key' => 'item', |
| 57 | + 'method' => 'toArray', |
| 58 | + 'pri' => 0, |
| 59 | + ], |
| 60 | + ], |
57 | 61 |
|
58 | | - /* |
59 | | - |----------------------------------------------------------------------------------------------------------- |
60 | | - | data-to-json encoding options |
61 | | - |----------------------------------------------------------------------------------------------------------- |
62 | | - | |
63 | | - */ |
64 | | - 'encoding_options' => JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE, |
| 62 | + /* |
| 63 | + |----------------------------------------------------------------------------------------------------------- |
| 64 | + | data-to-json encoding options |
| 65 | + |----------------------------------------------------------------------------------------------------------- |
| 66 | + | |
| 67 | + */ |
| 68 | + 'encoding_options' => JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE, |
65 | 69 |
|
66 | | - /* |
67 | | - |----------------------------------------------------------------------------------------------------------- |
68 | | - | Exception handler error codes |
69 | | - |----------------------------------------------------------------------------------------------------------- |
70 | | - | |
71 | | - */ |
72 | | - 'exception_handler' => [ |
73 | | - 'exception' => [ |
| 70 | + /* |
| 71 | + |----------------------------------------------------------------------------------------------------------- |
| 72 | + | Exception handler error codes |
| 73 | + |----------------------------------------------------------------------------------------------------------- |
| 74 | + | |
| 75 | + */ |
| 76 | + 'exception_handler' => [ |
| 77 | + 'exception' => [ |
74 | 78 | // 'http_not_found' => [ |
75 | 79 | // 'code' => \App\ApiCodes::HTTP_NOT_FOUND(), |
76 | 80 | // 'http_code' => Symfony\Component\HttpFoundation\Response::HTTP_BAD_REQUEST, |
|
95 | 99 | // 'code' => \App\ApiCodes::VALIDATION_EXCEPTION(), |
96 | 100 | // 'http_code' => Symfony\Component\HttpFoundation\Response::HTTP_UNPROCESSABLE_ENTITY, |
97 | 101 | // ], |
98 | | - ], |
99 | | - ], |
| 102 | + ], |
| 103 | + ], |
100 | 104 |
|
101 | | - /* |
102 | | - |----------------------------------------------------------------------------------------------------------- |
103 | | - | Debug config |
104 | | - |----------------------------------------------------------------------------------------------------------- |
105 | | - | |
106 | | - */ |
107 | | - 'debug' => [ |
108 | | - 'debug_key' => 'debug', |
109 | | - 'exception_handler' => [ |
110 | | - 'trace_key' => 'trace', |
111 | | - 'trace_enabled' => env('APP_DEBUG', false), |
112 | | - ], |
113 | | - ], |
| 105 | + /* |
| 106 | + |----------------------------------------------------------------------------------------------------------- |
| 107 | + | Debug config |
| 108 | + |----------------------------------------------------------------------------------------------------------- |
| 109 | + | |
| 110 | + */ |
| 111 | + 'debug' => [ |
| 112 | + 'debug_key' => 'debug', |
| 113 | + 'exception_handler' => [ |
| 114 | + 'trace_key' => 'trace', |
| 115 | + 'trace_enabled' => env('APP_DEBUG', false), |
| 116 | + ], |
| 117 | + ], |
114 | 118 |
|
115 | 119 | ]; |
0 commit comments