restore soft deleted item in database - 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: restore soft deleted item in database (/showthread.php?tid=75803) |
restore soft deleted item in database - niklas - 03-18-2020 Hello, i am using the ci Model Class with $useSoftDeletes = true. Now i want to implement a recycle bin to my application. Searching the deleted items works fine.. but i don't know how to restore these itemes? I tried to update($primaryKey,['deleted_at'=>null]) or an update with complete user data in hope that an update deletes the delete timestamp... But nothing worked. I searched in the documentation but there is nothing about restore.. just how to prevent deleting with soft_deletes I hope someone can help me solving this problem... best regards, Niklas RE: restore soft deleted item in database - includebeer - 03-22-2020 You should be able to restore a row by setting the deleted_at field to NULL. I wonder if the update was actually executed of if it was discarded because the data is null. Can you confirm what actual SQL query was executed? RE: restore soft deleted item in database - niklas - 03-25-2020 (03-22-2020, 08:31 AM)includebeer Wrote: You should be able to restore a row by setting the deleted_at field to NULL. I wonder if the update was actually executed of if it was discarded because the data is null. Can you confirm what actual SQL query was executed? I fixed it - my mistake was that i didn't add "deleted_at" to the allowed field array in my model |