|
@@ 317-327 (lines=11) @@
|
| 314 |
|
* |
| 315 |
|
* @return \Illuminate\Pagination\LengthAwarePaginator |
| 316 |
|
*/ |
| 317 |
|
public function paginate($perPage = 15, $pageName = 'page') |
| 318 |
|
{ |
| 319 |
|
$page = Paginator::resolveCurrentPage($pageName); |
| 320 |
|
$total = $this->count(); |
| 321 |
|
$results = $this->forPage($page, $perPage)->getList(); |
| 322 |
|
|
| 323 |
|
return new LengthAwarePaginator($results, $total, $perPage, $page, [ |
| 324 |
|
'path' => Paginator::resolveCurrentPath(), |
| 325 |
|
'pageName' => $pageName, |
| 326 |
|
]); |
| 327 |
|
} |
| 328 |
|
|
| 329 |
|
/** |
| 330 |
|
* Get a paginator only supporting simple next and previous links. |
|
@@ 339-348 (lines=10) @@
|
| 336 |
|
* |
| 337 |
|
* @return \Illuminate\Pagination\Paginator |
| 338 |
|
*/ |
| 339 |
|
public function simplePaginate($perPage = 15, $pageName = 'page') |
| 340 |
|
{ |
| 341 |
|
$page = Paginator::resolveCurrentPage($pageName); |
| 342 |
|
$results = $this->forPage($page, $perPage + 1)->getList(); |
| 343 |
|
|
| 344 |
|
return new Paginator($results, $perPage, $page, [ |
| 345 |
|
'path' => Paginator::resolveCurrentPath(), |
| 346 |
|
'pageName' => $pageName, |
| 347 |
|
]); |
| 348 |
|
} |
| 349 |
|
|
| 350 |
|
/** |
| 351 |
|
* Stop the query from touching DB. |