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.6] Allow higher order Collection::groupBy() #23608

Merged

Conversation

derekmd
Copy link
Contributor

@derekmd derekmd commented Mar 19, 2018

$collection->groupBy('attribute') makes $collection->groupBy->attribute somewhat redundant (unless you prefer the latter syntax.)

This change is for method calls returning computed values.

$collection->groupBy->computed()

Instead of:

$collection->groupBy(function ($item) {
    return $item->computed();
})

collect()->groupBy->computed() instead of
relying on a Closure value retriever.
@taylorotwell taylorotwell merged commit 87838b5 into laravel:5.6 Mar 19, 2018
@derekmd derekmd deleted the collection-groupby-higher-order-proxy branch March 19, 2018 17:40
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