Exemplo n.º 1
0
 /**
  * Get a paginator for an ungrouped statement.
  *
  * @param  \Nova\Pagination\Factory  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Nova\Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->query->getPaginationCount();
     $page = $paginator->getCurrentPage($total);
     $this->query->forPage($page, $perPage);
     return $paginator->make($this->get($columns)->all(), $total, $perPage);
 }
Exemplo n.º 2
0
 /**
  * Get a paginator for an ungrouped statement.
  *
  * @param  \Pagination\Environment  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->query->getPaginationCount();
     $page = $paginator->getCurrentPage($total);
     $query = $this->query->forPage($page, $perPage);
     // Retrieve the results from database.
     $results = $query->get($columns);
     return $paginator->make($results, $total, $perPage);
 }
Exemplo n.º 3
0
 /**
  * Get a paginator for an ungrouped statement.
  *
  * @param  \Nova\Pagination\Factory  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Nova\Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->query->getPaginationCount();
     // Once we have the paginator we need to set the limit and offset values for
     // the query so we can get the properly paginated items. Once we have an
     // array of items we can create the paginator instances for the items.
     $page = $paginator->getCurrentPage($total);
     $this->query->forPage($page, $perPage);
     return $paginator->make($this->get($columns)->all(), $total, $perPage);
 }