mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-03 05:50:25 +08:00
Fix handling validation errors
This commit is contained in:
parent
b2a514d3fe
commit
0da5c0ce41
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user