File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -165,11 +165,15 @@ public function hasFilter(string $filter): bool
165
165
*
166
166
* @param string $filter
167
167
*
168
- * @return string |null
168
+ * @return int|mixed |null
169
169
*/
170
- public function getFilter (string $ filter ): ? string
170
+ public function getFilter (string $ filter )
171
171
{
172
- return $ this ->hasFilter ($ filter ) ? $ this ->filters [$ filter ] : null ;
172
+ if ($ this ->hasFilter ($ filter )) {
173
+ return $ this ->hasIntegerKeys ($ filter ) ? (int )$ this ->filters [$ filter ] : $ this ->filters [$ filter ];
174
+ }
175
+
176
+ return null ;
173
177
}
174
178
175
179
/**
@@ -206,9 +210,22 @@ public function getFilterOptions(string $filter): array
206
210
return collect ($ this ->filters ()[$ filter ]->options ())
207
211
->keys ()
208
212
->reject (fn ($ item ) => $ item === '' || $ item === null )
213
+ ->values ()
209
214
->toArray ();
210
215
}
211
216
217
+ /**
218
+ * Check whether the filter has numeric keys or not
219
+ *
220
+ * @param string $filter
221
+ *
222
+ * @return bool
223
+ */
224
+ public function hasIntegerKeys (string $ filter ): bool
225
+ {
226
+ return is_int ($ this ->getFilterOptions ($ filter )[0 ] ?? null );
227
+ }
228
+
212
229
/**
213
230
* Collects columns with $searchable = true
214
231
*
You can’t perform that action at this time.
0 commit comments