Is there a way to prevent soft deleted records appearing in global search?
I have checked the documentation for this but I cannot seem to find if this is a configurable option or not.
I would like for records that have been soft deleted, to not be returned by the global search, is this possible?
7 Replies
The default behavior is not to display the soft deleted records when use SoftDeletes trait. But if it does for any reason, you can use
getGlobalSearchEloquentQuery()
method to modify the queryThank you Mohamed, I will take a look into that!
You're welcome
Hey, I came back to this and tried adding the following to a resource class:
However I must be doing it in the wrong place / or something wrong as the soft-deleted records are still showing.
Hi! First, ensure that you are import the SoftDeletes trait in your model. If do and still soft-deleted records returned in the global search some how, then try to do the following as your code force it to display the soft delete records:
Ok ill try this, is this on the project resource level?
This appears to have worked thank you.
You're welcome