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