Skip to content

Commit 628d1bb

Browse files
authored
use offset() in place of skip() (#56081)
in all of these changes, `skip()` is a direct alias of the `offset()` method, and performs no additional logic. switching to directly calling the `offset()` method means less code execution (minimallly better performance) and reduces the call stack (nice for debugging).
1 parent 322ffaf commit 628d1bb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'p
11191119
// Next we will set the limit and offset for this query so that when we get the
11201120
// results we get the proper section of results. Then, we'll create the full
11211121
// paginator instances for these results with the given page and per page.
1122-
$this->skip(($page - 1) * $perPage)->take($perPage + 1);
1122+
$this->offset(($page - 1) * $perPage)->take($perPage + 1);
11231123

11241124
return $this->simplePaginator($this->get($columns), $perPage, $page, [
11251125
'path' => Paginator::resolveCurrentPath(),

0 commit comments

Comments
 (0)