From d71d7d242249a305b647d494b3576954d5e9c5c2 Mon Sep 17 00:00:00 2001 From: Joe Sandford-Hughes <35659248+jsandfordhughes@users.noreply.github.com> Date: Mon, 16 Aug 2021 22:51:34 +0100 Subject: [PATCH] Fixed non string columns breaking model filter with collection driver (#507) * Added check for string * Fixed styling --- src/Engines/CollectionEngine.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Engines/CollectionEngine.php b/src/Engines/CollectionEngine.php index 49facdf6..f2582d1d 100644 --- a/src/Engines/CollectionEngine.php +++ b/src/Engines/CollectionEngine.php @@ -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; }