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