@@ 294-304 (lines=11) @@ | ||
291 | * |
|
292 | * @return \Illuminate\Pagination\LengthAwarePaginator |
|
293 | */ |
|
294 | public function paginate($perPage = 15, $pageName = 'page') |
|
295 | { |
|
296 | $page = Paginator::resolveCurrentPage($pageName); |
|
297 | $total = $this->count(); |
|
298 | $results = $this->forPage($page, $perPage)->getList(); |
|
299 | ||
300 | return new LengthAwarePaginator($results, $total, $perPage, $page, [ |
|
301 | 'path' => Paginator::resolveCurrentPath(), |
|
302 | 'pageName' => $pageName, |
|
303 | ]); |
|
304 | } |
|
305 | ||
306 | /** |
|
307 | * Get a paginator only supporting simple next and previous links. |
|
@@ 316-325 (lines=10) @@ | ||
313 | * |
|
314 | * @return \Illuminate\Pagination\Paginator |
|
315 | */ |
|
316 | public function simplePaginate($perPage = 15, $pageName = 'page') |
|
317 | { |
|
318 | $page = Paginator::resolveCurrentPage($pageName); |
|
319 | $results = $this->forPage($page, $perPage + 1)->getList(); |
|
320 | ||
321 | return new Paginator($results, $perPage, $page, [ |
|
322 | 'path' => Paginator::resolveCurrentPath(), |
|
323 | 'pageName' => $pageName, |
|
324 | ]); |
|
325 | } |
|
326 | ||
327 | /** |
|
328 | * Stop the query from touching DB. |