Welcome Guest, Not a member yet? Register   Sign In
model->delete() with SoftDelete how to undelete?
#1

Reference : https://codeigniter4.github.io/userguide...tml#delete
with $useSoftDeletes: true one can 'hide a row'.
Is there an option to undelete()?
Bart Goossens
Project Linde37
[email protected]
Reply
#2

(08-03-2023, 09:06 PM)Project Linde37 Wrote: Is there an option to undelete()?

No.
Reply
#3

$builder->set('deleted_at', null)->update($id); ?
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply
#4

You simply have to set the deleted_at field to null (deleted rows contain datetime string there).

So, running something like

model('YourModel')->update(3, ['deleted_at' => null]);

Would do the trick
==

Donatas G.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB