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

[11.x] Feature/whereany closures #52555

Merged
merged 7 commits into from
Aug 22, 2024

Conversation

liamduckett
Copy link
Contributor

Hey guys, this PR expands the docblock for the following methods, on Illuminate/Database/Query/Builder.php

  • whereAll
  • orWhereAll
  • whereAny
  • orWhereAny
  • whereNone
  • orWhereNone

to allow passing in an array of closures.

// before
User::query()
    ->where(fn(Builder $query) => $query->one())
    ->orWhere(fn(Builder $query) => $query->two())
    ->orWhere(fn(Builder $query) => $query->three());

// after
User::query()
    ->whereAny([
        fn(Builder $query) => $query->one(),
        fn(Builder $query) => $query->two(),
        fn(Builder $query) => $query->three(),
    ]);

This functionality already works, so only typehints & tests are added.

May be worth noting my original usecase involves scopes, but this didn't feel relevant to the tests.

@liamduckett liamduckett changed the title Feature/whereany closures [11.x] Feature/whereany closures Aug 22, 2024
@taylorotwell taylorotwell merged commit 738bc11 into laravel:11.x Aug 22, 2024
28 of 29 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