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