当前位置: 首页>>代码示例>>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;未经允许,请勿转载。