Custom validations for settings

This commit is contained in:
David Bomba 2019-10-10 12:18:00 +11:00
parent 3123547e55
commit 60020734d5

View File

@ -101,7 +101,7 @@ class Handler extends ExceptionHandler
else if($exception instanceof MethodNotAllowedHttpException){
return response()->json(['message'=>'Method not support for this route'],404);
}
else if ($exception instanceof ValidationException) {
else if ($exception instanceof ValidationException && $request->expectsJson()) {
return response()->json(['message' => 'The given data was invalid.', 'errors' => $exception->validator->getMessageBag()], 422);
}