Skip to content

Commit

Permalink
feat: Add config for fail http status #19
Browse files Browse the repository at this point in the history
  • Loading branch information
jiannei committed Mar 19, 2021
1 parent c17bf93 commit fabd99b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions config/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
return [
'enum' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::class,

'error_code' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::HTTP_INTERNAL_SERVER_ERROR,

'validation_error_code' => \Jiannei\Enum\Laravel\Repositories\Enums\HttpStatusCodeEnum::HTTP_UNPROCESSABLE_ENTITY,

'format' => [
Expand Down
2 changes: 1 addition & 1 deletion src/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function fail(string $message = '', int $code = 500, $errors = null, arra
{
$response = $this->response(
$this->formatData(null, $message, $code, $errors),
$code,
Config::get('response.error_code', $code),
$header,
$options
);
Expand Down

0 comments on commit fabd99b

Please sign in to comment.