Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.7] Collection whereBetween #26888

Merged
merged 3 commits into from
Dec 18, 2018
Merged

[5.7] Collection whereBetween #26888

merged 3 commits into from
Dec 18, 2018

Conversation

dmitryuk
Copy link
Contributor

@dmitryuk dmitryuk commented Dec 18, 2018

This PR adds posibility to make whereBetween filters in Collections.
$c = new Collection([['v' => 1], ['v' => 2], ['v' => 3], ['v' => '3'], ['v' => 4]]);
$c->whereBetween('v', [2, 4])

@morloderex
Copy link
Contributor

What about numeric arrays?

e.g. [1,2,3,4,5,6], it would be a little bit weird to pass in $collection->whereBetween(null, [2,6]) And would this even work?

@dmitryuk
Copy link
Contributor Author

dmitryuk commented Dec 18, 2018

What about numeric arrays?

e.g. [1,2,3,4,5,6], it would be a little bit weird to pass in $collection->whereBetween(null, [2,6]) And would this even work?

It working usign "where" conditions and works like it, i.e. as you can not use "where" condition with numeric arrays

src/Illuminate/Support/Collection.php Outdated Show resolved Hide resolved
@driesvints driesvints dismissed their stale review December 18, 2018 10:40

DocBlock was fixed

@taylorotwell taylorotwell merged commit 59b4b5f into laravel:5.7 Dec 18, 2018
@LasseRafn
Copy link
Contributor

Honest question; why not just 3 parameters? $key, $from, $to (or whatever name)

@LasseRafn
Copy link
Contributor

Nevermind, I just realized this is the Query Builders logic as well. Ignore me!

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.

5 participants