Skip to content

Commit 62c63c5

Browse files
Update readme
1 parent f04f320 commit 62c63c5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,18 @@ $collection->groupByModel('model', 'myModel');
243243
// ];
244244
```
245245

246+
If you want to specify the model items' name, you can pass it as the third parameter:
247+
248+
```php
249+
$collection->groupByModel('model', 'myModel', 'myItems');
250+
```
251+
252+
It's also possible to preserve the items' keys.
253+
254+
```php
255+
$collection->groupByModel('model', null, null, true);
256+
```
257+
246258
### `sectionBy`
247259

248260
Splits a collection into sections grouped by a given key. Similar to `groupBy` but respects the order of the items in the collection and reuses existing keys.

0 commit comments

Comments
 (0)