![]() |
Delete method failing - 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: Delete method failing (/showthread.php?tid=87516) |
Delete method failing - BilltheCat - 04-27-2023 I'm running into a strange issue with record (soft) deletes, and I can't track down where it's coming from. Checking my logs, I see that it does attempt to delete the record but the ID is '$'. I also checked the HTML source, and the ID is placed correctly in the delete path. Help... Controller: PHP Code: public function deleteUser($id = null) Model: PHP Code: protected $useSoftDeletes = true; View: PHP Code: <a href="<?= base_url('admin/users/delete/') . $user->id ?>">Delete</a> Route: PHP Code: $routes->get('users/delete/(:num)', 'Admin\Users::deleteUser/$'); Logs: Code: UPDATE `users` SET `deleted_at` = '2023-04-28 01:08:29', `updated_at` = '2023-04-28 01:08:29' RE: Delete method failing - BilltheCat - 04-27-2023 Never mind, I found it. The route only had the '$' , so that's what was fed into the delete function: $routes->get('users/delete/(:num)', 'Admin\Users::deleteUser/$1'); RE: Delete method failing - InsiteFX - 04-27-2023 PHP Code: $routes->get('users/delete/(:num)', 'Admin\Users::deleteUser/$'); RE: Delete method failing - BilltheCat - 04-27-2023 Thanks? lol, yeah, that's what I said. |