diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a8dec512..2e660ca3 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -62,7 +62,7 @@ class Handler extends ExceptionHandler if ($e instanceof ValidationException) { // Quick fix for returning 422 // @see https://prinzeugen.net/custom-responses-of-laravel-validations/ - if ($request->expectsJson()) { + if ($request->expectsJson() || $request->ajax()) { return response()->json([ 'errno' => 1, 'msg' => $e->validator->errors()->first()