Skip to content

Commit 315edad

Browse files
committed
Get perPage param from query, fallback to model perPage setting
* Closes #7
1 parent 6b34fcd commit 315edad

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)