Example #1
0
 /**
  * Get a paginator only supporting simple next and previous links.
  *
  * This is more efficient on larger data-sets, etc.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function simplePaginate($perPage = null, $columns = array('*'))
 {
     $paginator = $this->connection->getPaginator();
     $page = $paginator->getCurrentPage();
     $perPage = $perPage ?: $this->model->getPerPage();
     $this->skip(($page - 1) * $perPage)->take($perPage + 1);
     return $paginator->make($this->get($columns), $perPage);
 }
Example #2
0
 /**
  * Get a paginator for the "select" statement.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($perPage = 15, $columns = array('*'))
 {
     $paginator = $this->connection->getPaginator();
     if (isset($this->groups)) {
         return $this->groupedPaginate($paginator, $perPage, $columns);
     } else {
         return $this->ungroupedPaginate($paginator, $perPage, $columns);
     }
 }