@@ 360-370 (lines=11) @@ | ||
357 | * |
|
358 | * @return \Illuminate\Pagination\LengthAwarePaginator |
|
359 | */ |
|
360 | public function paginate($perPage = 15, $pageName = 'page') |
|
361 | { |
|
362 | $page = Paginator::resolveCurrentPage($pageName); |
|
363 | $total = $this->count(); |
|
364 | $results = $this->forPage($page, $perPage)->getList(); |
|
365 | ||
366 | return new LengthAwarePaginator($results, $total, $perPage, $page, [ |
|
367 | 'path' => Paginator::resolveCurrentPath(), |
|
368 | 'pageName' => $pageName, |
|
369 | ]); |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * Get a paginator only supporting simple next and previous links. |
|
@@ 382-391 (lines=10) @@ | ||
379 | * |
|
380 | * @return \Illuminate\Pagination\Paginator |
|
381 | */ |
|
382 | public function simplePaginate($perPage = 15, $pageName = 'page') |
|
383 | { |
|
384 | $page = Paginator::resolveCurrentPage($pageName); |
|
385 | $results = $this->forPage($page, $perPage + 1)->getList(); |
|
386 | ||
387 | return new Paginator($results, $perPage, $page, [ |
|
388 | 'path' => Paginator::resolveCurrentPath(), |
|
389 | 'pageName' => $pageName, |
|
390 | ]); |
|
391 | } |
|
392 | ||
393 | /** |
|
394 | * Stop the query from touching DB. |