jeudi 27 septembre 2018

How to toggle laravel trashed filter off temporarily?

So I've got an A, which has a B that has a C that has a D. I want to go from A to D, but any one (or all) of the objects might have been deleted. So I have to do this:

$d = $a->b()->withTrashed()->first()->c()->withTrashed()->first()->d()->withTrashed()->first()

Which is horrible. I would really rather do this:

turnOffTrashedFilter();
$d = $a->b->c->d;

Does laravel have such an ability?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2xU3JWW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire