Skip to content

Commit 84b7201

Browse files
authored
only use and document the limit and offset methods (#10516)
`skip()` and `take()` are alias methods to `offset()` and `limit()`. IMO we should only use and document the main methods, not the aliases. This will encourage more performant coding, just like we now do in `laravel/framework`. IF it's decided we still want to mention the aliases, I'd recommended listing them second as the alternatives. I can make that change if desired.
1 parent 656126b commit 84b7201

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

eloquent.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ The Eloquent `all` method will return all of the results in the model's table. H
431431
```php
432432
$flights = Flight::where('active', 1)
433433
->orderBy('name')
434-
->take(10)
434+
->limit(10)
435435
->get();
436436
```
437437

queries.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,16 +1210,7 @@ To build more advanced `having` statements, see the [havingRaw](#raw-methods) me
12101210
<a name="limit-and-offset"></a>
12111211
### Limit and Offset
12121212

1213-
<a name="skip-take"></a>
1214-
#### The `skip` and `take` Methods
1215-
1216-
You may use the `skip` and `take` methods to limit the number of results returned from the query or to skip a given number of results in the query:
1217-
1218-
```php
1219-
$users = DB::table('users')->skip(10)->take(5)->get();
1220-
```
1221-
1222-
Alternatively, you may use the `limit` and `offset` methods. These methods are functionally equivalent to the `take` and `skip` methods, respectively:
1213+
You may use the `limit` and `offset` methods to limit the number of results returned from the query or to skip a given number of results in the query:
12231214

12241215
```php
12251216
$users = DB::table('users')

0 commit comments

Comments
 (0)