Skip to content

Commit cb64e20

Browse files
authored
Merge pull request #5 from helloMJW/master
更新数组函数6.x
2 parents 678be5a + 1944091 commit cb64e20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

laravel/app/Exceptions/Handler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Illuminate\Validation\ValidationException;
1212
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
1313
use Tymon\JWTAuth\Exceptions\TokenBlacklistedException;
14+
use Illuminate\Support\Arr;
1415

1516
class Handler extends ExceptionHandler
1617
{
@@ -59,7 +60,7 @@ public function render($request, Exception $exception)
5960
if ($exception instanceof ValidationException) {
6061
// $code = 1104;
6162
// 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())));
6364
}
6465
// 用户认证的异常,我们需要返回 401 的 http code 和错误信息
6566
if ($exception instanceof UnauthorizedHttpException) {

0 commit comments

Comments
 (0)