$cart->group()
Groups the elements by a given field or callback function. Returns a new collection with an element for each group and a subcollection in each group
$cart->group(string|Closure $field, bool $caseInsensitive = true): Kirby\Toolkit\Collection
Parameters
| Name | Type | Default |
|---|---|---|
$field |
string or Closure |
- |
$caseInsensitive |
bool |
true |
Return type
Exceptions
| Type | Description |
|---|---|
Exception |
if $field is not a string nor a callback function |
Parent class
Wagnerwagner\Merx\Cart inherited from Kirby\Toolkit\Collection