Example #1
0
 /**
  * Get a paginator for the "select" statement.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($perPage = null, $columns = array('*'))
 {
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = Paginator::resolveCurrentPage(), $perPage = $perPage ?: $this->entityMap->getPerPage());
     return new LengthAwarePaginator($this->get($columns)->all(), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
 }