Skip to content

Commit 6a7b590

Browse files
Update readme
1 parent 4ee5278 commit 6a7b590

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ The package will automatically register itself.
4949
- [`none`](#none)
5050
- [`paginate`](#paginate)
5151
- [`range`](#range)
52+
- [`rotate`](#rotate)
5253
- [`sectionBy`](#sectionby)
5354
- [`simplePaginate`](#simplepaginate)
5455
- [`sliceBefore`](#slicebefore)
@@ -280,6 +281,20 @@ Creates a new collection instance with a range of numbers. This functions accept
280281
collect()->range(1, 3)->toArray(); //returns [1,2,3]
281282
```
282283

284+
### `rotate`
285+
286+
Rotate the items in the collection with given offset
287+
288+
```php
289+
$collection = collect([1, 2, 3, 4, 5, 6]);
290+
291+
$rotate = $collection->rotate(1);
292+
293+
$rotate->toArray();
294+
295+
// [2, 3, 4, 5, 6, 1]
296+
```
297+
283298
### `sectionBy`
284299

285300
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.
@@ -343,7 +358,7 @@ collect([20, 51, 10, 50, 66])->sliceBefore(function($item) {
343358
Extract the tail from a collection. So everything except the first element. It's a shorthand for `slice(1)->values()`, but nevertheless very handy. It's a shorthand for `slice(1)->values()`. If the optional parameter `$preserveKeys` as `true` is passed, it will preserve the keys and fallback to `slice(1)`.
344359

345360
```php
346-
collect([1, 2, 3))->tail(); // return collect([2, 3])
361+
collect([1, 2, 3])->tail(); // return collect([2, 3])
347362
```
348363

349364
### `toPairs`
@@ -397,20 +412,6 @@ Collection::withSize(1)->toArray(); // return [1];
397412
Collection::withSize(5)->toArray(); // return [1,2,3,4,5];
398413
```
399414

400-
### `rotate`
401-
402-
Rotate the items in the collection with given offset
403-
404-
```php
405-
$collection = collect([1, 2, 3, 4, 5, 6]);
406-
407-
$rotate = $collection->rotate(1);
408-
409-
$rotate->toArray();
410-
411-
// [2, 3, 4, 5, 6, 1]
412-
```
413-
414415

415416
## Changelog
416417

0 commit comments

Comments
 (0)