CodeIgniter Forums
How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - 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 Cancel The Delete in ‘’$useSoftDeletes = true‘’ (/showthread.php?tid=82577)



How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - cwwjsyc - 07-26-2022

in Models set:

protected $useSoftDeletes = true;

when some items was deleted  like : itemModel->delete([1,2,3]);
Then , we need cancle this. has any function like unDelete() ....


RE: How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - kilishan - 07-26-2022

Set the `deleted_at` value to `null` for the records you want to un-delete.


RE: How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - ozornick - 07-27-2022

Yesterday I ran into this situation. If you set the entity $user->deletedAt = null, it may not be able to update the entry. It says "No data to update"
The $user->hasChanged() method returns true.
If you make a request using QB $model->set(deleted_at, null)->update(id), it also fails to save


RE: How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - SoccerGuy3 - 10-14-2022

(07-27-2022, 11:28 PM)ozornick Wrote: Yesterday I ran into this situation. If you set the entity $user->deletedAt = null, it may not be able to update the entry. It says "No data to update"
The $user->hasChanged() method returns true.
If you make a request using QB $model->set(deleted_at, null)->update(id), it also fails to save

I am running into this same issue, were you able to solve it?


RE: How Cancel The Delete in ‘’$useSoftDeletes = true‘’ - InsiteFX - 10-15-2022

IF you think it's a bug then leave an issue on the CodeIgniter GitHub Development.