|
11 | 11 | use Illuminate\Validation\ValidationException;
|
12 | 12 | use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
|
13 | 13 | use Tymon\JWTAuth\Exceptions\TokenBlacklistedException;
|
| 14 | +use Illuminate\Support\Arr; |
14 | 15 |
|
15 | 16 | class Handler extends ExceptionHandler
|
16 | 17 | {
|
@@ -59,7 +60,7 @@ public function render($request, Exception $exception)
|
59 | 60 | if ($exception instanceof ValidationException) {
|
60 | 61 | // $code = 1104;
|
61 | 62 | // return response(['error' => array_first(array_collapse($exception->errors()))], 400);
|
62 | | - return $this->getResultByCode(1104, array_first(array_collapse($exception->errors()))); |
| 63 | + return $this->getResultByCode(1104, Arr::first(Arr::collapse($exception->errors()))); |
63 | 64 | }
|
64 | 65 | // 用户认证的异常,我们需要返回 401 的 http code 和错误信息
|
65 | 66 | if ($exception instanceof UnauthorizedHttpException) {
|
|
0 commit comments