![]() |
How do I send the second segment as id to update method? - 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: How do I send the second segment as id to update method? (/showthread.php?tid=78210) |
How do I send the second segment as id to update method? - blaasvaer - 12-15-2020 I 'think' I need to pass a different segment to the UPDATE method on the model in an attempt to update a resource (RESTFully). According to the docs: Code: Change the Placeholder Used But in my case the resource ('photos') is dynamic, so I need to pass segment AFTER the first 'segment' as I guess CI sees it as a segment because it's dynamic. Are there ANY mechanisms for working with the segment in the route, and what I pass to the method – update in this case? RE: How do I send the second segment as id to update method? - tgix - 12-15-2020 (12-15-2020, 05:47 AM)blaasvaer Wrote: I 'think' I need to pass a different segment to the UPDATE method on the model in an attempt to update a resource (RESTFully). The routes file is parsed top to bottom so you can alway override defined routes. If you put a separate get() with two arguments after your resource() definition it will match that. If you always have two arguments, you can look into the "except" option to resource() to not define certain functions. |