Skip to content

Commit

Permalink
fix: manual pagination not triggered
Browse files Browse the repository at this point in the history
  • Loading branch information
lpheller authored Feb 21, 2025
1 parent 0e0ce6a commit 7d32bf9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Concerns/PaginateIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ public function pageName(string $pageName)
return $this;
}

public function paginateFromRequest(Request $request)
public function paginateFromRequest(Request $request, $perPage = null)
{
if (($request->has('page') || $request->has('perPage')) == false) {
if (($request->has('page') || $request->has('perPage')) == false && $perPage === null) {
return $this;
}

$perPage = $request->get('perPage', $this->perPage);
$perPage = $perPage ?? $request->get('perPage', $this->perPage);

return $this->query()
->paginate($perPage, ['*'], $this->pageName)
Expand Down

0 comments on commit 7d32bf9

Please sign in to comment.