Skip to content

Commit 69a6fd3

Browse files
authored
Merge pull request #943 from inmula/main
Fix ability to filter models by an array as filter value
2 parents 41278ce + b8251a8 commit 69a6fd3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Filters/FiltersPartial.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function __invoke(Builder $query, $value, string $property)
2525
$databaseDriver = $this->getDatabaseDriver($query);
2626

2727
if (is_array($value)) {
28-
if (count(array_filter($value, fn ($item) => empty($item))) === 0) {
28+
if (count(array_filter($value, fn ($item) => strlen($item) > 0)) === 0) {
2929
return $query;
3030
}
3131

3232
$query->where(function (Builder $query) use ($databaseDriver, $value, $wrappedProperty) {
33-
foreach (array_filter($value, fn ($item) => empty($item)) as $partialValue) {
33+
foreach (array_filter($value, fn ($item) => strlen($item) > 0) as $partialValue) {
3434
[$sql, $bindings] = $this->getWhereRawParameters($partialValue, $wrappedProperty, $databaseDriver);
3535
$query->orWhereRaw($sql, $bindings);
3636
}

0 commit comments

Comments
 (0)