當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。