Skip to content

[5.6] Allow higher order Collection::groupBy() - #23608

Merged
taylorotwell merged 1 commit into
laravel:5.6from
derekmd:collection-groupby-higher-order-proxy
Mar 19, 2018
Merged

taylorotwell merged 1 commit into
laravel:5.6from
derekmd:collection-groupby-higher-order-proxy

Conversation

@derekmd

@derekmd derekmd commented Mar 19, 2018

Copy link
Copy Markdown
Contributor

$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