diff --git a/src/Traits/FilterTrait.php b/src/Traits/FilterTrait.php index 46d26d2..396f29a 100644 --- a/src/Traits/FilterTrait.php +++ b/src/Traits/FilterTrait.php @@ -128,7 +128,8 @@ public function scopeFilter($query, $param = [], $arr_filter = []) if (!$method_exists) throw new NotFoundException($filter_name . " not found"); - if (!empty($param[$search_key])) { + //laravel middleware will convert empty string to null + if (isset($param[$search_key]) && !is_null($param[$search_key])) { $callback = $this->createFilterClosure($filter_name, $search_key, $param); if ($relation) { $query->whereHas($relation, $callback);