How come we need to disable the SoftDeletingScope::class on the resource but not on relation manager
I'm starting to implement soft deletes across my models and while the documentation says we need to add
->withoutGlobalScope(SoftDeletingScope::class)
to the resource, why then do I not need to add this to the relation manager class via the ->modifyQueryUsing()
method?Solution:Jump to solution
It does but the it won't show deleted records without adjusting the query because the softdeletes always applies it without removing it
5 Replies
You only want to do that if you want to be able to access soft-deleted records?
It seems you can already access soft deletes on the relation manager without it though
@morty check the queries? We shouldn't be auto applying to a relationship because we wouldn't know if that relationship has soft deletes
This is the query without removing the soft delete scope AND no trashed filter on the table:
This is the query when just adding the trashed filter only:
This is the query with again only adding the trashed filter but selecting either with deleted or only deleted:
And finally, this is the query after adding the
withoutGlobalScope()
and also still using the trashed filter:
So it would seem to me that just adding the trashed filter does the same thing?
Regardless, the documentation says to remove the global scope so I will be doing that but I was just curious why it was still working.Solution
It does but the it won't show deleted records without adjusting the query because the softdeletes always applies it without removing it