collection::groupBy

Groups the collection by a given field

collection::groupBy($field, $i = true)

Parameters

$field (string)

Return values

object
A new collection with an item for each group and a subcollection in each group