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


PHP Builder::forPage方法代碼示例

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


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

示例1: executeQuery

 /**
  * 주어진 db query를 실행한다.
  *
  * @param Builder            $query      질의
  * @param int|int[]|stdClass $navigation 검색시 사용할 navigation(page, perPage, sort, order) 정보
  *
  * @return array
  */
 protected function executeQuery($query, $navigation = null)
 {
     // set default
     $order = $this->defaultOrder;
     $sort = $this->defaultSort;
     $perPage = $this->defaultPerPage;
     $page = null;
     if (is_array($navigation)) {
         list($page, $perPage) = $navigation;
     } elseif (is_object($navigation)) {
         $page = data_get($navigation, 'page', $page);
         $perPage = data_get($navigation, 'perPage', $perPage);
         $order = data_get($navigation, 'order', $order);
         $sort = data_get($navigation, 'sort', $sort);
     }
     if ($sort !== null) {
         $query->orderBy($sort, $order);
     }
     if ($navigation === null) {
         $collection = $query->get();
     } elseif ($page !== null) {
         $collection = $query->forPage($page, $perPage);
     } else {
         $collection = $query->paginate($perPage);
     }
     return $collection;
 }
開發者ID:mint-soft-com,項目名稱:xpressengine,代碼行數:35,代碼來源:DatabaseRepositoryTrait.php

示例2: paginate

 protected function paginate(Builder $builder, $perPage)
 {
     $page = Paginator::resolveCurrentPage();
     $total = $builder->count();
     $query = $builder->forPage($page, $perPage);
     $results = $query->get();
     return new LengthAwarePaginator($results, $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
 }
開發者ID:vegax87,項目名稱:Strimoid,代碼行數:8,代碼來源:Repository.php

示例3: paginate

 /**
  * Paginate the given query.
  *
  * @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)
 {
     if ($perPage <= 0) {
         throw new InvalidArgumentException("Negative 'perPage' value provided to 'paginate' method.");
     }
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
 }
開發者ID:npmweb,項目名稱:framework,代碼行數:20,代碼來源:Builder.php

示例4: ungroupedPaginate

 /**
  * Get a paginator for an ungrouped statement.
  *
  * @param  \Illuminate\Pagination\Environment  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->query->getPaginationCount();
     // Once we have the paginator we need to set the limit and offset values for
     // the query so we can get the properly paginated items. Once we have an
     // array of items we can create the paginator instances for the items.
     $page = $paginator->getCurrentPage($total);
     $this->query->forPage($page, $perPage);
     return $paginator->make($this->get($columns)->all(), $total, $perPage);
 }
開發者ID:aysenli,項目名稱:laravel-admin-1,代碼行數:18,代碼來源:Builder.php

示例5: forPage

 /**
  * Set the limit and offset for a given page.
  *
  * @param int $page
  * @param int $perPage
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function forPage($page, $perPage = 15)
 {
     return \Illuminate\Database\Query\Builder::forPage($page, $perPage);
 }
開發者ID:satriashp,項目名稱:tour,代碼行數:12,代碼來源:_ide_helper.php

示例6: paginate

 /**
  * Paginate the given query.
  *
  * @param  int  $perPage
  * @param  array  $columns
  * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
  */
 public function paginate($perPage = 15, $columns = ['*'])
 {
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = Paginator::resolveCurrentPage(), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns)->all(), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath()]);
 }
開發者ID:visualturk,項目名稱:framework,代碼行數:13,代碼來源:Builder.php

示例7: paginate

 /**
  * Paginate the given query.
  *
  * @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)
 {
     $total = $this->query->getCountForPagination();
     $this->query->forPage($page = $page ?: Paginator::resolveCurrentPage($pageName), $perPage = $perPage ?: $this->model->getPerPage());
     return new LengthAwarePaginator($this->get($columns), $total, $perPage, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
 }
開發者ID:drickferreira,項目名稱:rastreador,代碼行數:17,代碼來源:Builder.php


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