Where does $this->model->update(????) get its params from when using the CI's Model? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Where does $this->model->update(????) get its params from when using the CI's Model? (/showthread.php?tid=78209) |
Where does $this->model->update(????) get its params from when using the CI's Model? - blaasvaer - 12-15-2020 I've created a very clever dynamic RESTFul API where the resource it set dynamically ... BUT, I now face an issue when trying to update a resource. I can't seem to use the 'built in' update method, as the $id is now the resource (the table) and $data the id ... Now, I set the table on the Model in the Controller's __construct method, so that it's set correctly in initialization. But I can't seem to figure out WHERE the 'built in' update method gets its parameters from; is it from the route? I have these routes: Code: $routes->get('api/(:segment)', 'Api::index/$1'); I seem to need to skip the first 'segment' (which is dynamic and comes in as a resource) when updating (as the resource - the table - is set in the __construct). HOW do I SKIP parameters when using the UPDATE method? I'm sending an object with a ID and DATA attributes, as in { id : 4, data: "serialized object" } ... |