10000 [9.x] Iterable value type for whereBetween by hebinet · Pull Request #36933 · laravel/framework · GitHub
[go: up one dir, main page]

Skip to content

[9.x] Iterable value type for whereBetween #36933

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

Merged
merged 2 commits into from
Apr 11, 2021
Merged

[9.x] Iterable value type for whereBetween #36933

merged 2 commits into from
Apr 11, 2021

Conversation

hebinet
Copy link
Contributor
@hebinet hebinet commented Apr 10, 2021

This PR changes the value argument type to iterable in Illuminate\Database\Query\Builder->whereBetween() method.

This enables the usage of every iterable like CarbonPeriod or Collection to be used as $value argument.

Usage

$period = now()->toPeriod(now()->addDay());

User::whereBetween('created_at', $period)->get();

// or

User::whereBetween('id', collect([1,2]))->get();

@hebinet hebinet changed the title [9.x] CarbonPeriod value type for whereBetween [9.x] Iterable value type for whereBetween Apr 10, 2021
@taylorotwell taylorotwell merged commit f7cd47a into laravel:master Apr 11, 2021
@hebinet hebinet deleted the carbon-period-in-where-between branch April 11, 2021 17:19
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
0