From 66f537363edb71893b74451327939f23b9f66b70 Mon Sep 17 00:00:00 2001 From: Dipesh Khanal Date: Wed, 10 Apr 2024 22:50:45 +0545 Subject: [PATCH] feat: added new error function in base controller --- src/Controller/ApiBaseController.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Controller/ApiBaseController.php b/src/Controller/ApiBaseController.php index 8b9a08f..9a18bfb 100644 --- a/src/Controller/ApiBaseController.php +++ b/src/Controller/ApiBaseController.php @@ -28,4 +28,15 @@ public function api_error($data) 'message' => $data->getMessage() ], $data->getCode()); } + + public function custom_error($status,$message) + { + return response()->json( + [ + 'status' => $status, + 'data' => [], + 'message' => $message + ], $status + ); + } }