Skip to content

Commit cad21d8

Browse files
committed
Backport whereIn fix
1 parent 2e8ff4b commit cad21d8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Query/Builder.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,15 @@ public function whereNotContains(string $attribute, string $value): static
925925
*/
926926
public function whereIn(string $attribute, array $values): static
927927
{
928+
if (empty($values)) {
929+
// If the array of values is empty, we will
930+
// add an empty OR filter to the query to
931+
// ensure that no results are returned.
932+
$this->rawFilter('(|)');
933+
934+
return $this;
935+
}
936+
928937
return $this->orFilter(function (Builder $query) use ($attribute, $values) {
929938
foreach ($values as $value) {
930939
$query->whereEquals($attribute, $value);

0 commit comments

Comments
 (0)