Skip to content

[13.x] Fix whereBetween and whereNotBetween with collection bounds - #62062

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:where-between-arrayable
Oct 17, 2026
Merged

taylorotwell merged 1 commit into
laravel:13.xfrom
xurshudyan:where-between-arrayable

Conversation

@xurshudyan

Copy link
Copy Markdown
Contributor

Passing a collection as the range to whereBetween() on a collection doesn't work. It uses reset() and end() on the object, so the bounds end up being the internal items array and false, and you just get an empty result without any error:

$range = $request->collect('price'); // [10, 50]

Product::whereBetween('price', $range)->get(); // works
$products->whereBetween('price', $range);      // always empty
$products->whereNotBetween('price', $range);   // returns everything

The docblock already says Arrayable|iterable, and whereIn() does the same getArrayableItems() call.

@taylorotwell
taylorotwell merged commit 0fd0747 into laravel:13.x Oct 17, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants