當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model::paginate方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Eloquent\Model::paginate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::paginate方法的具體用法?PHP Model::paginate怎麽用?PHP Model::paginate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Eloquent\Model的用法示例。


在下文中一共展示了Model::paginate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: paginate

 /**
  * @param int $perPage
  * @return mixed
  */
 public function paginate($perPage = 15, array $with = array())
 {
     $this->addWithCriteria($with);
     $this->applyCriteria();
     $result = $this->model->paginate($perPage);
     $this->refresh();
     return $result;
 }
開發者ID:ablunier,項目名稱:laravel-database,代碼行數:12,代碼來源:Repository.php

示例2: getAllPaginated

 public function getAllPaginated($with = [], $perPage = 10)
 {
     if (isset($with) && !empty($with)) {
         if (!is_array($with)) {
             throw new InvalidArgumentException();
         }
         return $this->model->with($with)->latest()->paginate($perPage);
     }
     return $this->model->paginate($perPage);
 }
開發者ID:christiannwamba,項目名稱:laravel-site,代碼行數:10,代碼來源:BaseRepository.php

示例3: fetch

 /**
  * Base fetch for all repository returns
  * This should be used when returning multiple records
  *
  * @param  Model $model - update model instance
  * @return Illuminate\Database\Eloquent\Collection
  */
 public function fetch($model = null)
 {
     if (!is_null($model)) {
         $this->model = $model;
     }
     $result = $this->paginated && is_int($this->paginated) ? $this->model->paginate($this->paginated) : $this->model->get();
     if ($this->paginated) {
         // Append custom query string to page links to maintain correct url filter and sorting
         $result = $result->appends($this->buildUrlQuery());
     }
     $this->reset();
     return $result;
 }
開發者ID:thinktomorrow,項目名稱:repo,代碼行數:20,代碼來源:BaseRepository.php

示例4: paginate

 /**
  * Retrieve all data of modal, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $limit = is_null($limit) ? config('modal.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     $this->resetModel();
     return $results;
 }
開發者ID:Jastkast,項目名稱:Page,代碼行數:15,代碼來源:BaseRepository.php

示例5: paginate

 /**
  * Retrieve all data of repository, paginated
  *
  * @param null  $limit
  * @param array $columns
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     return $this->wrap(function ($limit = null, $columns = ['*']) {
         $limit = is_null($limit) ? $this->perPage : $limit;
         return $this->model->paginate($limit, $columns);
     }, new Action(__METHOD__, func_get_args(), Action::READ));
 }
開發者ID:sandeeprajoria,項目名稱:Housekeeper,代碼行數:14,代碼來源:BaseRepository.php

示例6: paginate

 /**
  * Return a paginated list of results.
  *
  * @param int|string $amount
  * @param int|string $page
  * @param int|string $perPage
  * @return array
  * @throws ModelNotSetException
  */
 public function paginate($amount, $page, $perPage)
 {
     if (!$this->model) {
         throw new ModelNotSetException('You must set a model to be used by the eloquent driver.');
     }
     return $this->model->paginate($amount, $this->select, $this->key)->all();
 }
開發者ID:michaeljennings,項目名稱:carpenter,代碼行數:16,代碼來源:Eloquent.php

示例7: paginate

 /**
  * Retrieve all data of repository, paginated
  * @param null $limit
  * @param array $columns
  * @return mixed
  */
 public function paginate($limit = null, $columns = array('*'))
 {
     $this->applyCriteria();
     $limit = is_null($limit) ? config('warehouse.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     return $this->parserResult($results);
 }
開發者ID:osvaldino,項目名稱:warehouse,代碼行數:13,代碼來源:BaseRepository.php

示例8: paginate

 /**
  * Retrieve all data of repository, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, array $columns = ['*'])
 {
     $this->applyCriteria()->applyOrder();
     $limit = $limit ?: config('repository.pagination.limit', 15);
     $results = $this->model->paginate($limit, $columns);
     $this->makeModel();
     return $this->parseResult($results);
 }
開發者ID:sjfinder,項目名稱:repository,代碼行數:16,代碼來源:BaseRepository.php

示例9: paginate

 /**
  * Retrieve all data of repository, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $this->applyCriteria();
     $this->applyScope();
     $limit = is_null($limit) ? config('repository.pagination.limit', 15) : $limit;
     $results = $this->model->paginate($limit, $columns);
     $this->resetModel();
     return $this->parserResult($results);
 }
開發者ID:LavaLite,項目名稱:framework,代碼行數:17,代碼來源:BaseRepository.php

示例10: customPaginate

 /**
  * Custom Paginate current results, for queries that cannot be paginated using paginate().
  *
  * @param int $total
  * @param int $per_page
  *
  * @return LengthAwarePaginator
  */
 public function customPaginate($total, $per_page = 20)
 {
     $this->per_page = $per_page;
     $this->buildQuery();
     $current_page = Paginator::resolveCurrentPage() ? Paginator::resolveCurrentPage() : 1;
     $data = $this->query->paginate($per_page)->items();
     $pagination = new LengthAwarePaginator($data, $total, $per_page, $current_page, ['path' => Paginator::resolveCurrentPath()]);
     return $pagination;
 }
開發者ID:bhutanio,項目名稱:laravel-utilities,代碼行數:17,代碼來源:DbRepository.php

示例11: paginate

 /**
  * @param null $perPage
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($perPage = null, $columns = ['*'])
 {
     $this->eagerLoading();
     $this->applyCriteria();
     $perPage = is_null($perPage) ? config('repository.pagination.perPage', 25) : $perPage;
     $results = $this->model->paginate($perPage, $columns);
     $this->resetModel();
     return $this->parseResult($results);
 }
開發者ID:killtw,項目名稱:repository,代碼行數:15,代碼來源:BaseRepository.php

示例12: paginate

 /**
  * @param int    $limit
  * @param array  $columns
  * @param string $pageName
  * @return mixed
  */
 public function paginate($limit = 15, $columns = ['*'], $pageName = 'page')
 {
     $this->applyBoot();
     $this->applyScopes();
     $this->applyCriteria();
     $result = $this->model->paginate($limit, $columns, $pageName);
     $this->cleanRepository();
     return $result;
 }
開發者ID:guilhermegonzaga,項目名稱:repository,代碼行數:15,代碼來源:Repository.php

示例13: paginate

 /**
  * Retrieve all data of modal, paginated.
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return mixed
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $limit = is_null($limit) ? config('modal.pagination.limit', 15) : $limit;
     if ($this->userFilter) {
         $userId = User::users('id');
         $results = $this->model->whereUserId($userId)->paginate($limit, $columns);
     } else {
         $results = $this->model->paginate($limit, $columns);
     }
     $this->resetModel();
     return $results;
 }
開發者ID:LavaliteCms,項目名稱:Example,代碼行數:20,代碼來源:BaseRepository.php

示例14: paginate

 /**
  * Paginates the entity
  *
  * @return \Illuminate\Pagination\LengthAwarePaginator
  */
 public function paginate(int $items = null) : LengthAwarePaginator
 {
     $items = is_null($items) ? $this->paginates : $items;
     return $this->entity->paginate($items);
 }
開發者ID:prjkt,項目名稱:repofuck,代碼行數:10,代碼來源:Repofuck.php

示例15: paginate

 /**
  * Return all rows paginate by value of $perPage
  * @param int $perPage
  * @param array $columns
  * @return mixed
  */
 public function paginate($perPage = 10, $columns = array('*'))
 {
     return $this->model->paginate($perPage, $columns);
 }
開發者ID:Burris19,項目名稱:ReposityLaravel,代碼行數:10,代碼來源:Repository.php


注:本文中的Illuminate\Database\Eloquent\Model::paginate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。