diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index cbd773f..a6ca715 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -4,6 +4,9 @@ namespace App\Exceptions; use Throwable; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use WM\Core\Exceptions\ValidationErrorException; +use WM\Core\Services\Responser; + class Handler extends ExceptionHandler { @@ -46,6 +49,10 @@ class Handler extends ExceptionHandler */ public function render($request, Throwable $exception) { + if ($exception instanceof ValidationErrorException) { + return response()->json(Responser::error('تاریخ مورد نظر در زمان انتخابی رزرو شده است',[trans('common::messages.over_lap_date')]), 500); + } + return parent::render($request, $exception); } }