Routing method delete or get - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Routing method delete or get (/showthread.php?tid=85134) |
Routing method delete or get - Beewez - 12-05-2022 Hello community, I have a question regarding the routing when I want to delete a record from the database. to delete the record I generate a link with the url (controller) and the id that I want to delete. In this case I leave this example of how I do it. Code: $routes->get('deleteUs/(:any)', 'usx\usxController::deleteUs/$1', ['as' => 'deleteUsx'); or should I use Code: $routes->delete RE: Routing method delete or get - InsiteFX - 12-06-2022 Yes! CodeIgniter 4 User Guide: While the add() method seems to be convenient, it is recommended to always use the HTTP-verb-based routes, described above, as it is more secure. If you use the CSRF protection, it does not protect GET requests. If the URI specified in the add() method is accessible by the GET method, the CSRF protection will not work. |