Skip to content

Commit 947433e

Browse files
committed
✨ Initialize multiselect filters as array
Signed-off-by: Julio Renzi C. Motol <[email protected]>
1 parent b47dc66 commit 947433e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/Traits/WithFilters.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,18 @@ public function filters(): array
114114
*/
115115
public function checkFilters(): void
116116
{
117-
foreach ($this->filters() as $filter => $_default) {
118-
if (! isset($this->filters[$filter]) || $this->filters[$filter] === '') {
119-
$this->filters[$filter] = null;
117+
foreach ($this->filters() as $key => $filter) {
118+
if (isset($this->filters[$key]) && filled($this->filters[$key])) {
119+
continue;
120120
}
121+
122+
// If the filter is multiselect, we'll initialize it as an array.
123+
if ($filter->isMultiSelect()) {
124+
$this->filters[$key] = [];
125+
continue;
126+
}
127+
128+
$this->filters[$key] = null;
121129
}
122130
}
123131

0 commit comments

Comments
 (0)