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

[9.x] Added callable support to operatorForWhere on Collection #41414

Merged
merged 3 commits into from Mar 10, 2022
Merged

[9.x] Added callable support to operatorForWhere on Collection #41414

merged 3 commits into from Mar 10, 2022

Commits on Mar 9, 2022

  1. [9.x] Added callable support to operatorForWhere on Collection

    Added `callable` support to `operatorForWhere`.
    
    Currently only Collection methods `where` and `whereFirst` are used without `callable` support.
    
    Adding callable to `operatorForWhere` allow complex usages as:
    
    ```php
    $city = $cities->firstWhere(fn ($city) => $city->state->available && ($city->state->id === $stateId));
    ```
    or
    ```php
    $state = $states->firstWhere(fn ($state) => (bool)$state->cities->firstWhere('id', $cityId));
    ```
    eusonlito committed Mar 9, 2022
    Configuration menu
    Copy the full SHA
    dca4026 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b848f18 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    82314e1 View commit details
    Browse the repository at this point in the history