Skip to content

Commit 477c10b

Browse files
authored
Update AbstractRepository.php
Fix pagination
1 parent 5945993 commit 477c10b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/Repositories/AbstractRepository.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -413,33 +413,35 @@ public function pluck($value, $key = null)
413413
/**
414414
* Retrieve all data of repository, paginated
415415
*
416-
* @param int $limit
417-
* @param array $columns
418-
* @param int|null $page
416+
* @param int $perPage
417+
* @param array $columns
418+
* @param string $pageName
419+
* @param int|null $page
419420
*
420-
* @return \Illuminate\Pagination\Paginator
421+
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
421422
*/
422-
public function paginate($limit = null, $columns = ['*'], $page = null)
423+
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
423424
{
424425
$this->newQuery();
425426

426-
return $this->query->paginate($limit, $columns, $page);
427+
return $this->query->paginate($perPage, $columns, $pageName, $page);
427428
}
428429

429430
/**
430431
* Retrieve all data of repository, paginated
431432
*
432-
* @param int $limit
433-
* @param array $columns
434-
* @param int|null $page
433+
* @param int $perPage
434+
* @param array $columns
435+
* @param string $pageName
436+
* @param int|null $page
435437
*
436-
* @return \Illuminate\Pagination\Paginator
438+
* @return \Illuminate\Contracts\Pagination\Paginator
437439
*/
438-
public function simplePaginate($limit = null, $columns = ['*'], $page = null)
440+
public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
439441
{
440442
$this->newQuery();
441443

442-
return $this->query->simplePaginate($limit, $columns, $page);
444+
return $this->query->simplePaginate($perPage, $columns, $pageName, $page);
443445
}
444446

445447
/**

0 commit comments

Comments
 (0)