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


PHP Builder::paginate方法代碼示例

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


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

示例1: paginate

 /**
  * Get paginated list
  *
  * @param int $perPage
  * @param array $columns
  * @return mixed
  */
 public function paginate($perPage = 15, $columns = ['*'])
 {
     $this->newQuery()->eagerLoad()->setClauses()->setScopes();
     $models = $this->query->paginate($perPage, $columns);
     $this->unsetClauses();
     return $models;
 }
開發者ID:Okipa,項目名稱:una.app,代碼行數:14,代碼來源:BaseRepository.php

示例2: 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

示例3: scopeGetConnection

 /**
  * Paginate connection w/ query args.
  *
  * @param  \Illuminate\Database\Eloquent\Builder $query
  * @param  array  $args
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeGetConnection($query, array $args)
 {
     $first = isset($args['first']) ? $args['first'] : 15;
     $after = $this->decodeCursor($args);
     $page = isset($args['page']) ? $args['page'] : 1;
     $currentPage = $first && $after ? floor(($first + $after) / $first) : $page;
     return $query->paginate($first, ['*'], 'page', $currentPage);
 }
開發者ID:nuwave,項目名稱:lighthouse,代碼行數:15,代碼來源:RelayConnection.php

示例4: 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

示例5: paginate

 /**
  * Paginate the results of this query
  *
  * @param  int
  * @param  int
  * @return $this
  */
 public function paginate($perPage, $page)
 {
     if ($perPage > 0) {
         Paginator::currentPageResolver(function () use($page) {
             return $page;
         });
         $this->paginator = $this->query->paginate($perPage);
     } else {
         $this->collection = $this->query->get();
     }
     return $this;
 }
開發者ID:lykegenes,項目名稱:laravel-api-response,代碼行數:19,代碼來源:EloquentQueryStrategy.php

示例6: paginate

 public function paginate($perPage = null, $columns = array("*"), $itemProcessor = null)
 {
     if ($this->disableEloficient) {
         return parent::paginate($perPage, $columns = array("*"));
     }
     $perPage = $perPage ?: ($_GET["perpage"] ?: $this->model->getPerPage());
     $paginator = $this->query->getConnection()->getPaginator();
     $this->prepareForPagination = true;
     $this->query->forPage($paginator->getCurrentPage(), $perPage);
     $collection = $this->get($columns);
     $totalRows = $this->getPaginationTotalRows();
     if ($itemProcessor instanceof Closure) {
         $collection = call_user_func($itemProcessor, $collection);
     }
     return $paginator->make($collection->all(), $totalRows, $perPage);
 }
開發者ID:fembri,項目名稱:eloficient,代碼行數:16,代碼來源:Builder.php

示例7: pagination

 /**
  * Pagination for query
  *
  * @param $query
  *
  * @return LengthAwarePaginator
  */
 protected function pagination(Builder $query, $page = null)
 {
     $action = $this->action;
     $page = is_null($page) ? Input::get('page') : $page;
     $max_per_page = $this->getConfig($action)['max_per_page'];
     return $query->paginate($max_per_page, ['*'], 'page', $page);
 }
開發者ID:tuanlq11,項目名稱:cms,代碼行數:14,代碼來源:Query.php

示例8: paginate

 /**
  * Get the paginated entries.
  *
  * @param  array $columns
  * @return Paginator
  */
 public function paginate($perPage = 15, array $columns = ['*'])
 {
     return (new Decorator())->decorate($this->query->paginate($perPage, $columns));
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:10,代碼來源:EloquentCriteria.php

示例9: paginate

 /**
  * 翻頁
  * @param int $perPage
  * @param string $pageName
  * @param int|null $page
  * @return static
  */
 public function paginate(int $perPage, string $pageName = 'page', int $page = null)
 {
     $this->original->paginate($perPage, ['*'], $pageName, $page);
     return $this;
 }
開發者ID:zhwei,項目名稱:laravel-lego,代碼行數:12,代碼來源:EloquentTable.php

示例10: paginate

 /**
  * @param Builder $builder
  * @return PageInterface
  */
 protected function paginate(Builder $builder)
 {
     $size = $this->getPerPage();
     $page = new Page($this->service);
     $data = $this->simplePagination ? $builder->simplePaginate($size) : $builder->paginate($size);
     $page->setData($data);
     return $page;
 }
開發者ID:cloudcreativity,項目名稱:laravel-json-api,代碼行數:12,代碼來源:AbstractSearch.php

示例11: paginate

 /**
  * Retrieve all data of repository, paginated
  *
  * @param null  $limit
  * @param array $columns
  *
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($limit = null, $columns = ['*'])
 {
     $this->newQuery();
     return $this->query->paginate($limit, $columns);
 }
開發者ID:torann,項目名稱:laravel-repository,代碼行數:13,代碼來源:AbstractRepository.php

示例12: findAllWithPagination

 /**
  * @param null $pagination
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  */
 public function findAllWithPagination($pagination = null)
 {
     $pagination = $pagination ?: self::PAGINATION;
     return $this->instance->paginate($pagination);
 }
開發者ID:az-iar,項目名稱:repository,代碼行數:9,代碼來源:BaseRepository.php

示例13: getPaginatedResults

 private static function getPaginatedResults(Builder $query)
 {
     return $query->paginate(config('settings.products.results'));
 }
開發者ID:mmonbr,項目名稱:20Pavos,代碼行數:4,代碼來源:FilterProduct.php

示例14: paginateAll

 /**
  * Paginate all posts.
  *
  * @param int $postsPerPage
  *
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  */
 public function paginateAll($postsPerPage)
 {
     return $this->model->paginate($postsPerPage);
 }
開發者ID:OzanKurt,項目名稱:KurtModules-Blog,代碼行數:11,代碼來源:EloquentTagsRepository.php

示例15: paginate

 /**
  * Paginate a result set and reset the query.
  *
  * @param {int} $limit
  *
  * @return \Illuminate\Pagination\Paginator
  */
 public function paginate($limit)
 {
     $ret = $this->query->paginate($limit);
     $this->reset();
     return $ret;
 }
開發者ID:sellerlabs,項目名稱:beakers,代碼行數:13,代碼來源:QueryBuilder.php


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