Open rico opened 7 years ago
i modified this engine a little to do the trick
added these lines in src/Engines/MySQLEngine.php
// line 59
if ($builder->callback) {
$query = call_user_func($builder->callback, $query);
}
and then i could do this in my controller
$products = Product::search($request->keyword, function($query) {
return $query->active()->withTrashed(); // local scope and soft deletes
})->paginate(20);
@sembrex - will this package already respect global scopes as it's querying the relevant table?
This is what I've had to use to get soft deletes in my results:
MyModel::search($text, function ($query) {
return $query->onlyTrashed();
})->get();
Weirdly, only works with the 'soft_delete' boolean set to 'false' in app/scout.php
Is there a way to include soft deleted models in the search results?
I tried several approached found around the net with no luck.
Maybe this is related to #17?