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