Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Oct 11, 2017
1 parent 4ee5278 commit 6a7b590
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The package will automatically register itself.
- [`none`](#none)
- [`paginate`](#paginate)
- [`range`](#range)
- [`rotate`](#rotate)
- [`sectionBy`](#sectionby)
- [`simplePaginate`](#simplepaginate)
- [`sliceBefore`](#slicebefore)
Expand Down Expand Up @@ -280,6 +281,20 @@ Creates a new collection instance with a range of numbers. This functions accept
collect()->range(1, 3)->toArray(); //returns [1,2,3]
```

### `rotate`

Rotate the items in the collection with given offset

```php
$collection = collect([1, 2, 3, 4, 5, 6]);

$rotate = $collection->rotate(1);

$rotate->toArray();

// [2, 3, 4, 5, 6, 1]
```

### `sectionBy`

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.
Expand Down Expand Up @@ -343,7 +358,7 @@ collect([20, 51, 10, 50, 66])->sliceBefore(function($item) {
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)`.

```php
collect([1, 2, 3))->tail(); // return collect([2, 3])
collect([1, 2, 3])->tail(); // return collect([2, 3])
```

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

### `rotate`

Rotate the items in the collection with given offset

```php
$collection = collect([1, 2, 3, 4, 5, 6]);

$rotate = $collection->rotate(1);

$rotate->toArray();

// [2, 3, 4, 5, 6, 1]
```


## Changelog

Expand Down

0 comments on commit 6a7b590

Please sign in to comment.