From b7404130ba8dc719c776746976101b3c26daf4f9 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Fri, 22 Sep 2023 12:11:24 +0000 Subject: [PATCH] Refactoring errors handlers --- app/Exceptions/ErrorHandle.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Exceptions/ErrorHandle.php b/app/Exceptions/ErrorHandle.php index dfeb52f..c70188e 100644 --- a/app/Exceptions/ErrorHandle.php +++ b/app/Exceptions/ErrorHandle.php @@ -14,22 +14,22 @@ class ErrorHandle extends BaseErrorHandler * handle the error * * @param Exception $exception - * @return mixed */ - public function handle($exception): mixed + public function handle($exception) { if (request()->isAjax()) { return $this->json($exception); } - if ($exception instanceof ModelNotFoundException || $exception instanceof HttpException) { + if ( + $exception instanceof ModelNotFoundException + || $exception instanceof HttpException + ) { $code = $exception->getStatusCode(); - $source = $this->render('errors.' . $code, [ + return $this->render('errors.' . $code, [ 'code' => 404, 'exception' => $exception ]); - - return $source; } if ($exception instanceof HttpResponseException) {