当前位置: 首页>>代码示例>>PHP>>正文


PHP Model::getPerPage方法代码示例

本文整理汇总了PHP中Illuminate\Database\Eloquent\Model::getPerPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::getPerPage方法的具体用法?PHP Model::getPerPage怎么用?PHP Model::getPerPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::getPerPage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: simplePaginate

 /**
  * Paginate the given query into a simple paginator.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @return \Illuminate\Contracts\Pagination\Paginator
  */
 public function simplePaginate($perPage = null, $columns = ['*'])
 {
     $page = Paginator::resolveCurrentPage();
     $perPage = $perPage ?: $this->model->getPerPage();
     $this->skip(($page - 1) * $perPage)->take($perPage + 1);
     return new Paginator($this->get($columns)->all(), $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
 }
开发者ID:visualturk,项目名称:framework,代码行数:14,代码来源:Builder.php

示例2: simplePaginate

 /**
  * 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->query->getConnection()->getPaginator();
     $page = $paginator->getCurrentPage();
     $perPage = $perPage ?: $this->model->getPerPage();
     $this->query->skip(($page - 1) * $perPage)->take($perPage + 1);
     return $paginator->make($this->get($columns)->all(), $perPage);
 }
开发者ID:peintune,项目名称:Ternado,代码行数:17,代码来源:Builder.php

示例3: paginate

 /**
  * Paginate the returned set of models.
  *
  * @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)
 {
     $query = $this->model->toBase();
     $total = $query->getCountForPagination();
     $model = $this->model->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     $results = new LengthAwarePaginator($this->hookPaginate($model->get($columns)), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
     $this->reset();
     return $results;
 }
开发者ID:propaganistas,项目名称:laravel-repository,代码行数:20,代码来源:Repository.php

示例4: paginate

 /**
  * Get a paginator for the "select" statement.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($perPage = null, $columns = array('*'))
 {
     $perPage = $perPage ?: $this->model->getPerPage();
     $paginator = $this->query->getConnection()->getPaginator();
     if (isset($this->query->groups)) {
         return $this->groupedPaginate($paginator, $perPage, $columns);
     } else {
         return $this->ungroupedPaginate($paginator, $perPage, $columns);
     }
 }
开发者ID:aysenli,项目名称:laravel-admin-1,代码行数:17,代码来源:Builder.php

示例5: getPerPage

 /**
  * Get per page items count.
  *
  * @return int
  */
 public function getPerPage()
 {
     return $this->model->getPerPage();
 }
开发者ID:guratr,项目名称:cruddy,代码行数:9,代码来源:BaseRepository.php


注:本文中的Illuminate\Database\Eloquent\Model::getPerPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。