Welcome Guest, Not a member yet? Register   Sign In
->onlyDeleted() returns all
#1

Hello,

I would like to use the softDelete Function from the CI Model Class. If I call the class with
PHP Code:
->where(xyz)->delete() 
it work's finde.
In my database the datetime will be written to "deleted_at".

But as i started to implement a recycle bin to my application i want to get all items which are not null in deleted_at.

CI Documentation says:
PHP Code:
$modelclass->onlyDeleted()->findAll(); 

But this return all entries also the not deleted... Undecided

I build a function on my own to get just deleted items. It looks like this and it is also working but i think this is not the right way..
PHP Code:
$deletedPersons = array();
foreach(
$allPersons as $person)
{
        if(strtotime($person->deleted_at) > 0)
        {
              array_push($deletedPersons,$person);
        }


Does anyone have experience with soft deletes in CI4 ?
Maybe I used it the wrong way?

best regards,
Niklas
Reply


Messages In This Thread
->onlyDeleted() returns all - by niklas - 03-18-2020, 09:09 AM
RE: ->onlyDeleted() returns all - by includebeer - 03-22-2020, 08:08 AM
RE: ->onlyDeleted() returns all - by niklas - 03-25-2020, 03:58 AM
RE: ->onlyDeleted() returns all - by includebeer - 03-27-2020, 02:25 PM
RE: ->onlyDeleted() returns all - by niklas - 03-30-2020, 05:58 AM
RE: ->onlyDeleted() returns all - by includebeer - 03-30-2020, 01:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB