getCountForPagination() публичный метод

Get the count of the total records for the paginator.
public getCountForPagination ( array $columns = ['*'] ) : integer
$columns array
Результат integer
Пример #1
0
 /**
  * Paginate the given query.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @param  string  $pageName
  * @param  int|null  $page
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  *
  * @throws \InvalidArgumentException
  */
 public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
 {
     if ($perPage <= 0) {
         throw new InvalidArgumentException("Negative 'perPage' value provided to 'paginate' method.");
     }
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
 }
Пример #2
0
 /**
  * Get the count of the total records for the paginator.
  *
  * @param array $columns
  * @return int 
  * @static 
  */
 public static function getCountForPagination($columns = array())
 {
     return \Illuminate\Database\Query\Builder::getCountForPagination($columns);
 }
Пример #3
0
 /**
  * Paginate the given query.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  */
 public function paginate($perPage = 15, $columns = ['*'])
 {
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = Paginator::resolveCurrentPage(), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns)->all(), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
 }
Пример #4
0
 /**
  * Paginate the given query.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @param  string  $pageName
  * @param  int|null  $page
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  *
  * @throws \InvalidArgumentException
  */
 public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
 {
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
 }
 /**
  * Get the count of the total records for the paginator.
  *
  * @return int 
  * @static 
  */
 public static function getCountForPagination()
 {
     return \Illuminate\Database\Query\Builder::getCountForPagination();
 }