Skip to content

Commit

Permalink
Resolves selahattinunlu#52: Query Builder pagination options passing.
Browse files Browse the repository at this point in the history
- Added additional step for identification current page before processing pagination query in the `QueryBuilder::basePaginate` method. It needs, because the `QueryBuilder::basePaginate`  is private and is called only once and only in this class. The method calls without `$page` parameter passing, so that the `$page` will always be `1` and the `Paginator::items` will have incorrect items.
  • Loading branch information
Black Maize God committed Jun 29, 2023
1 parent 79dc040 commit a5d5616
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ private function addAppendsToModel($result)
*/
private function basePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
{
$page = $page ?: BasePaginator::resolveCurrentPage($pageName);
if (is_null($page)) {
$page = $this->page ?: BasePaginator::resolveCurrentPage($pageName);
}

$perPage = $perPage ?: $this->model->getPerPage();

Expand Down

0 comments on commit a5d5616

Please sign in to comment.