Global search query is pulling in trashed models
My global search queries don't seem to be applying the soft delete scope. Is this intentional?
For example, here is one of the queries. The
Part
model has the soft delete trait.
5 Replies
After looking at the source, it seems the global search query is just using the regular query which when using soft deletes you have to remove the soft delete scope. I've added
withoutTrashed()
to all of my resources that are global search enabled. It seems like this shouldn't be the default though imo.
You should just overwrite the table query via
modifyQuery()
instead of using getEloquentQuery()
This would then break the edit page and restore/delete functionality, wouldn't it?
Oh yes. You are right.
Then you probably need to adjust readd the scope via the
getGlobalSearchEloquentQuery
.
@Dan Harrin Maybe we should add a note to the docs? Or is there another way around this?i guess the resource stub could be updated so when we include the geteloquentquery modification, we also include getglobalsearcheloquentquery to apply the scope