Skip to content

Commit 06ba0c5

Browse files
author
jiannei
committed
feat: enumeration optional
1 parent ab7c133 commit 06ba0c5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
}
1010
],
1111
"require": {
12-
"ext-json": "*"
1312
},
1413
"require-dev": {
1514
"orchestra/testbench": "^6.4",

config/response.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
*/
1111

1212
return [
13-
'enum' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::class,
14-
1513
/*
1614
|--------------------------------------------------------------------------
1715
| Set the http status code when the response fails
@@ -29,7 +27,7 @@
2927
// Set the http status code returned when the form validation fails.
3028
// When the error_code is set to 200 or 500, it will not work
3129

32-
'validation_error_code' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::HTTP_UNPROCESSABLE_ENTITY,
30+
'validation_error_code' => 422,
3331

3432
// Set the structure of the paging data return,the following structure will be returned by default,
3533
// You can modify the name of the inner data field through the following configuration items, such as rows or list
@@ -53,4 +51,14 @@
5351
'data_field' => 'data',
5452
],
5553
],
54+
55+
// You can use enumerations to define the code when the response is returned,
56+
// and set the response message according to the locale
57+
//
58+
// The following two enumeration packages are good choices
59+
//
60+
// https://github.com/Jiannei/laravel-enum
61+
// https://github.com/BenSampo/laravel-enum
62+
63+
'enum' => '',// \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::class
5664
];

0 commit comments

Comments
 (0)