Skip to content

Commit 642b9d7

Browse files
authored
Merge pull request #8
Allow to specify the `perPage` limit from the query param
2 parents 6b34fcd + 315edad commit 642b9d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Actions/PaginateResults.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ public function __construct(
1515
) {}
1616

1717
public function handle(Builder $query, Closure $next): Collection | LengthAwarePaginator {
18+
$perPage = $this->request->integer('perPage', $query->getModel()->getPerPage());
19+
1820
return $next($this->request->boolean('all')
1921
? $query->get()
20-
: $query->paginate()->withQueryString()
22+
: $query->paginate($perPage)->withQueryString()
2123
);
2224
}
2325

0 commit comments

Comments
 (0)