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