From 60020734d58e0c30c50e8381bdc2a1feb4f7c0d1 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 10 Oct 2019 12:18:00 +1100 Subject: [PATCH] Custom validations for settings --- app/Exceptions/Handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5d81eaa6df03..109ac3b8bcb2 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -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); }