updated api Cartoons

This commit is contained in:
mrNikto9 2024-07-18 09:58:53 +05:00
parent 95955c989b
commit bb602f97b3
1 changed files with 10 additions and 2 deletions

View File

@ -55,10 +55,13 @@ class CartoonsController extends Controller
$data = $this->Cartoons::find($id); $data = $this->Cartoons::find($id);
if ($data){ if (!is_null($data)){
return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]); return $this->helpers->apiArrayResponseBuilder(200, 'success', [$data]);
} else { } 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 getBeforeFilters() {return [];}
public static function getMiddleware() {return [];} public static function getMiddleware() {return [];}
public function callAction($method, $parameters=false) { public function callAction($method, $parameters=false) {
if(isset($parameters['cartoon'])) $parameters = [$parameters['cartoon']];
return call_user_func_array(array($this, $method), $parameters); return call_user_func_array(array($this, $method), $parameters);
} }
} }