Skip to content

Commit 0187c99

Browse files
committed
fix: resolve pagination issue with select column
- Fixed the issue causing pagination with the select column in QueryBuilder. - Removed unused function calls.
1 parent 1df65bf commit 0187c99

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/QueryBuilder.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -465,16 +465,10 @@ public function orWhereBetween($column, $start, $end)
465465
public function paginate($pageNo = 0, $perPage = 10)
466466
{
467467
$offset = ($pageNo > 1) ? ($pageNo * $perPage) - $perPage : 0;
468+
469+
$data = $this->take($perPage)->skip($offset)->get($this->select ?? ['*']);
468470

469-
$totalItems = (int) $this->count();
470-
471-
$this->take($perPage)->skip($offset);
472-
473-
$this->getLimit();
474-
475-
$this->getOffset();
476-
477-
$data = $this->get();
471+
$totalItems = (int) $this->count();
478472

479473
$pages = ceil($totalItems / $perPage);
480474

0 commit comments

Comments
 (0)