getCountForPagination() public method

Get the count of the total records for the paginator.
public getCountForPagination ( array $columns = ['*'] ) : integer
$columns array
return integer
コード例 #1
0
ファイル: Builder.php プロジェクト: npmweb/framework
 /**
  * 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
ファイル: _ide_helper.php プロジェクト: satriashp/tour
 /**
  * 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
ファイル: Builder.php プロジェクト: visualturk/framework
 /**
  * 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
ファイル: Builder.php プロジェクト: drickferreira/rastreador
 /**
  * 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]);
 }
コード例 #5
0
 /**
  * Get the count of the total records for the paginator.
  *
  * @return int 
  * @static 
  */
 public static function getCountForPagination()
 {
     return \Illuminate\Database\Query\Builder::getCountForPagination();
 }