Skip to content

Commit

Permalink
Fixed non string columns breaking model filter with collection driver (
Browse files Browse the repository at this point in the history
…#507)

* Added check for string

* Fixed styling
  • Loading branch information
jsandfordhughes authored Aug 16, 2021
1 parent 86c406c commit d71d7d2
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 @@ -120,6 +120,10 @@ protected function searchModels(Builder $builder)
foreach ($columns as $column) {
$attribute = $model->{$column};

if (! is_string($attribute)) {
continue;
}

if (Str::contains(Str::lower($attribute), Str::lower($builder->query))) {
return true;
}
Expand Down

0 comments on commit d71d7d2

Please sign in to comment.