Skip to content

Commit

Permalink
filter on should be searchable
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jun 29, 2021
1 parent cfc9e16 commit ad60f5b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Engines/CollectionEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ protected function searchModels(Builder $builder)
$columns = array_keys($models->first()->toSearchableArray());

return $models->filter(function ($model) use ($builder, $columns) {
if (! $model->shouldBeSearchable()) {
return false;
}

foreach ($columns as $column) {
$attribute = $model->{$column};

Expand Down

0 comments on commit ad60f5b

Please sign in to comment.