From fa42cac4f41ae419cf462228d93a0133e3ad204c Mon Sep 17 00:00:00 2001 From: Trots-Aleksandrov Kostiantyn Date: Mon, 21 May 2018 21:47:20 +0300 Subject: [PATCH] Refactored errors handling for ajax request --- src/ClamavValidator/ClamavValidatorException.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ClamavValidator/ClamavValidatorException.php b/src/ClamavValidator/ClamavValidatorException.php index 027f74c..a46385b 100644 --- a/src/ClamavValidator/ClamavValidatorException.php +++ b/src/ClamavValidator/ClamavValidatorException.php @@ -26,7 +26,10 @@ public function makeResponse() if (request()->expectsJson()) { return response()->json([ - $this->attribute => $message + 'errors' => [ + $this->attribute => $message + ], + 'message' => $message ], 422); }