Skip to content

Commit

Permalink
[8.x] Document the collection range() method (laravel#7355)
Browse files Browse the repository at this point in the history
* Add range() documentation

* Update collections.md

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
antoinelame and taylorotwell authored Oct 14, 2021
1 parent 4d8e1c4 commit 44b4297
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions collections.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ For the majority of the remaining collection documentation, we'll discuss each m
[push](#method-push)
[put](#method-put)
[random](#method-random)
[range](#method-range)
[reduce](#method-reduce)
[reduceMany](#method-reduce-many)
[reject](#method-reject)
Expand Down Expand Up @@ -1702,6 +1703,17 @@ You may pass an integer to `random` to specify how many items you would like to

If the collection instance has fewer items than requested, the `random` method will throw an `InvalidArgumentException`.

<a name="method-range"></a>
#### `range()` {#collection-method}

The `range` method returns a collection containing integers between the specified range:

$collection = collect()->range(3, 6);

$collection->all();

// [3, 4, 5, 6]

<a name="method-reduce"></a>
#### `reduce()` {#collection-method}

Expand Down

0 comments on commit 44b4297

Please sign in to comment.