You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is OK but I don't really like it because it is a "terminal" method (like all(), find(), ...) whereas I need it to be used more like a scope so that I could write things like $myRepo->withTrashed()->find(...).
Obviously it always returns me an empty result set because the generated SQL query contains a filter of the form WHERE deleted_at IS NULL AND deleted_at IS NOT NULL.
Hi,
I am using Laravel built-in soft-deletion feature for some model and would like to create the
withTrashed
scope on my repository.Best I could do so far is this:
which is OK but I don't really like it because it is a "terminal" method (like
all()
,find()
, ...) whereas I need it to be used more like a scope so that I could write things like$myRepo->withTrashed()->find(...)
.I also naively tried this approach:
Obviously it always returns me an empty result set because the generated SQL query contains a filter of the form
WHERE deleted_at IS NULL AND deleted_at IS NOT NULL
.Moreover, I tried this:
Which is exactly what I need but it does not work because it looks like
SoftDeletingScope::class
is re-added automatically at some point.Is there any way I can make this last example work?
Thank you in advance and best!
The text was updated successfully, but these errors were encountered: