searchable icon indicating copy to clipboard operation
searchable copied to clipboard

Doesn’t search soft deletes

Open RicLeP opened this issue 6 years ago • 1 comments

When using withTrashed it still only finds non-soft deleted items

where users.deleted_at is null

RicLeP avatar Jun 25 '18 14:06 RicLeP

I've ran into this issue today. What worked for me was to call withTrashed before the search.

It was:

public function index() {
    // ...
    $users = User::search($query)->withTrashed()->paginate();
   // ...
}

Fixed by changing to:

public function index() {
    // ...
    $users = User::withTrashed()->search($query)->paginate();
   // ...
}

ferrl avatar Dec 24 '18 16:12 ferrl