From 02c251dc87907ad7133c07c7378309a2e3c94be5 Mon Sep 17 00:00:00 2001 From: huangbule Date: Fri, 15 Mar 2024 10:15:21 +0800 Subject: [PATCH] 'fix_bug' --- src/Traits/FilterTrait.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);