From bb602f97b38492e876d0e71b4c599466e9ed4bde Mon Sep 17 00:00:00 2001 From: mrNikto9 Date: Thu, 18 Jul 2024 09:58:53 +0500 Subject: [PATCH] updated api Cartoons --- .../controllers/api/CartoonsController.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/CartoonsController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/CartoonsController.php index bebc732..ce66e49 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/CartoonsController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/CartoonsController.php @@ -55,10 +55,13 @@ class CartoonsController extends Controller $data = $this->Cartoons::find($id); - if ($data){ + if (!is_null($data)){ return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); } else { - $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); + // dd("d"); + // $this->helpers->apiArrayResponseBuilder(404, 'not found', ['error' => 'Resource id=' . $id . ' could not be found']); + return $this->helpers->apiArrayResponseBuilder(404, 'error', [$data]); + } } @@ -117,7 +120,12 @@ class CartoonsController extends Controller public static function getBeforeFilters() {return [];} public static function getMiddleware() {return [];} public function callAction($method, $parameters=false) { + if(isset($parameters['cartoon'])) $parameters = [$parameters['cartoon']]; return call_user_func_array(array($this, $method), $parameters); } + + + + } \ No newline at end of file