Delete method failing |
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'
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'); PHP Code: $routes->get('users/delete/(:num)', 'Admin\Users::deleteUser/$'); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |