From 4e9213e4dd66b327c411eca7b732ad2983ff2028 Mon Sep 17 00:00:00 2001 From: Luan Freitas <33601626+luanfreitasdev@users.noreply.github.com> Date: Sun, 4 Feb 2024 17:45:52 -0300 Subject: [PATCH] Fix persist clearfilter (#1386) --- src/Concerns/Filter.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Concerns/Filter.php b/src/Concerns/Filter.php index 2dc17ad6..2d756840 100644 --- a/src/Concerns/Filter.php +++ b/src/Concerns/Filter.php @@ -39,17 +39,7 @@ public function clearFilter(string $field = '', bool $emit = true): void $explodeField = explode('.', $field); $currentArray = &$this->filters[$key]; - $lastIndex = array_pop($explodeField); - - foreach ($explodeField as $index) { - if (isset($currentArray[$index]) && is_array($currentArray[$index])) { - $currentArray = &$currentArray[$index]; - } else { - return; - } - } - - unset($currentArray[$lastIndex]); + unset($currentArray[$explodeField[0]]); } unset($this->filters[$key][$field]);