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] Add whereNotBetween method to Collection #27028

Merged

Conversation

amaelftah
Copy link
Contributor

@amaelftah amaelftah commented Jan 1, 2019

this PR adds whereNotBetween to collection object , since we have whenEmpty & whenNotEmpty , whereIn & whereNotIn , i thought that whereNotBetween method should be added to collection object as a convention

$collection = collect([
    ['product' => 'Pencil', 'price' => 30],
    ['product' => 'Chair', 'price' => 80],
    ['product' => 'Door', 'price' => 100],
    ['product' => 'Bookcase', 'price' => 150],
   ['product' => 'Desk', 'price' => 200],
]);

$filtered = $collection->whereNotBetween('price', [100, 200]);

$filtered->all();

/*
    [
        ['product' => 'Bookcase', 'price' => 30],
        ['product' => 'Bookcase', 'price' => 80],
    ]
*/

@taylorotwell taylorotwell merged commit 87cf8f1 into laravel:5.7 Jan 2, 2019
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.

None yet

2 participants