From 74b81554e604c977360a981b9699e7c4693f3d1c Mon Sep 17 00:00:00 2001 From: Dan Date: Sat, 25 May 2024 16:20:54 +0200 Subject: [PATCH] Fix duplicated buttons --- src/Concerns/Filter.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Concerns/Filter.php b/src/Concerns/Filter.php index e6989ae6..c2959de5 100644 --- a/src/Concerns/Filter.php +++ b/src/Concerns/Filter.php @@ -404,16 +404,19 @@ protected function powerGridQueryString(string $prefix = ''): array } if ($filter->key === 'number') { - $_start = $as->append('_start')->toString(); - $_end = $as->append('_end')->toString(); + $_start = $as->append('_start')->toString(); + $_end = $as->append('_end')->toString(); + $fieldProcessed = false; $queryString['filters.number.' . $filter->field . '.start'] = [ 'as' => $_start, 'except' => '', ]; - if (!is_null(request()->get($_start))) { + if (!$fieldProcessed && !is_null(request()->get($_start))) { $this->addEnabledFilters($filter->field . '_start', strval($columns->get($filter->field, $filter->field))); + + $fieldProcessed = true; } $queryString['filters.number.' . $filter->field . '.end'] = [ @@ -421,8 +424,10 @@ protected function powerGridQueryString(string $prefix = ''): array 'except' => '', ]; - if (!is_null(request()->get($_end))) { + if (!$fieldProcessed && !is_null(request()->get($_end))) { $this->addEnabledFilters($filter->field . '_end', strval($columns->get($filter->field, $filter->field))); + + $fieldProcessed = true; } continue;