Skip to content

Commit fabd99b

Browse files
author
jiannei
committed
feat: Add config for fail http status #19
1 parent c17bf93 commit fabd99b

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

config/response.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
return [
1313
'enum' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::class,
1414

15+
'error_code' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::HTTP_INTERNAL_SERVER_ERROR,
16+
1517
'validation_error_code' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::HTTP_UNPROCESSABLE_ENTITY,
1618

1719
'format' => [

src/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function fail(string $message = '', int $code = 500, $errors = null, arra
145145
{
146146
$response = $this->response(
147147
$this->formatData(null, $message, $code, $errors),
148-
$code,
148+
Config::get('response.error_code', $code),
149149
$header,
150150
$options
151151
);

0 commit comments

Comments
 (0)