zingimmick /
laravel-query-builder
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Zing\QueryBuilder\Concerns; |
||
| 6 | |||
| 7 | use Zing\QueryBuilder\Paginator; |
||
| 8 | |||
| 9 | trait Pageable |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param string|\Zing\QueryBuilder\Paginator $paginator |
||
| 13 | * |
||
| 14 | * @return $this |
||
| 15 | */ |
||
| 16 | 7 | public function enablePaginator($paginator = null) |
|
| 17 | { |
||
| 18 | 7 | $paginator = $paginator instanceof Paginator ? $paginator : Paginator::name($paginator); |
|
| 19 | 7 | $perPage = $this->request->input($paginator->getName()) ?: $paginator->getDefault(); |
|
| 20 | 7 | $this->getBuilder() |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 21 | 7 | ->getModel() |
|
| 22 | 7 | ->setPerPage($perPage); |
|
| 23 | |||
| 24 | 7 | return $this; |
|
| 25 | } |
||
| 26 | } |
||
| 27 |