TitasGailius / nova-search-relations

This package allow you to include relationship columns into Laravel Nova search query.
Other
352 stars 33 forks source link

Search soft deleted relations #13

Closed preliot closed 4 years ago

preliot commented 5 years ago

This package will nog search soft deleted related models. Default Nova behaviour allows this when you filter on 'include with deleted'. Would be nice to have this.

And thanks for this package, it works like a charme!

itamas commented 4 years ago

You have to modify the core trait of this package. The key function is applyRelationSearch(). Modified function: (71 - 73 lines) $query->orWhereHas($relation, function ($query) use ($columns, $search) { $query->where(static::searchQueryApplier($columns, $search))->withTrashed(); })->withTrashed();

preliot commented 4 years ago

But wouldn't that always search with trashed models? Nova lets you choose whether you search with or without.. Or am i mistaken?

TitasGailius commented 4 years ago

With the new release https://github.com/TitasGailius/nova-search-relations/pull/27, you may now extend the search for your custom needs.