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


PHP Builder::skip方法代碼示例

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


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

示例1: filter

 private function filter(\Illuminate\Database\Eloquent\Builder $_db)
 {
     $_db->take($this->limit);
     if (Request::get('offset')) {
         $_db->skip(Request::get('offset'));
     }
     return $_db;
 }
開發者ID:PingadoWeb,項目名稱:deliveryApi,代碼行數:8,代碼來源:ProductsRepository.php

示例2: filter

 private function filter(\Illuminate\Database\Eloquent\Builder $_db)
 {
     $_db->take($this->limit);
     if (Request::get('offset')) {
         $_db->skip(Request::get('offset'));
     }
     if (Request::get('q')) {
         $_db->where('description', 'like', Request::get('q') . '%');
     }
     return $_db;
 }
開發者ID:PingadoWeb,項目名稱:deliveryApi,代碼行數:11,代碼來源:CategoriesRepository.php

示例3: getItems

 public function getItems($limit, $offset)
 {
     $builder = $this->query->getQuery();
     if ($builder->groups || $builder->unions) {
         $row = DB::selectOne("SELECT COUNT(*) qty FROM (" . $this->query->toSql() . ") sub", $this->query->getBindings());
         $total = (int) $row->qty;
     } else {
         $total = $this->query->count();
     }
     $pageOfItems = $this->query->skip($offset)->take($limit)->get();
     return [$pageOfItems, $total];
 }
開發者ID:phonedotcom,項目名稱:mason-laravel,代碼行數:12,代碼來源:EloquentContainer.php

示例4: setClauses

 /**
  * Set clauses on the query builder
  *
  * @return $this
  */
 protected function setClauses()
 {
     foreach ($this->wheres as $where) {
         $this->query->where($where['column'], $where['operator'], $where['value']);
     }
     foreach ($this->whereIns as $whereIn) {
         $this->query->whereIn($whereIn['column'], $whereIn['values']);
     }
     foreach ($this->orderBys as $orders) {
         $this->query->orderBy($orders['column'], $orders['direction']);
     }
     if (isset($this->take) and !is_null($this->take)) {
         $this->query->take($this->take);
     }
     if (isset($this->skip) and !is_null($this->skip)) {
         $this->query->skip($this->skip);
     }
     if (isset($this->paginate) and !is_null($this->paginate)) {
         $this->query->paginate($this->paginate);
     }
     return $this;
 }
開發者ID:Okipa,項目名稱:una.app,代碼行數:27,代碼來源:BaseRepository.php

示例5: pagination

 /**
  * Возвращает коллекцию в виде пагинации
  *
  * @param int $page
  * @param int $limit
  */
 public function pagination($page, $limit = 10)
 {
     /**
      * @var \Illuminate\Support\Collection $data
      */
     $countTotal = $this->_query->count();
     $this->_query->skip($limit * $page - $limit);
     $this->_query->limit($limit);
     $data = collect();
     foreach ($this->_query->get() as $key => $instance) {
         $_listRow = [];
         foreach ($this->columns->getColumns() as $column) {
             $_listRow[$column->getKey()] = $column->getValues($instance);
         }
         $buttons = $this->filterAction($instance);
         if (count($buttons)) {
             $_listRow = array_merge($_listRow, [GridColumn::ACTION_NAME => implode('', $buttons)]);
         }
         $data->offsetSet($key, $_listRow);
     }
     return new \Illuminate\Pagination\LengthAwarePaginator($data, $countTotal, $limit, $page, ['path' => \Illuminate\Pagination\Paginator::resolveCurrentPath(), 'pageName' => 'page']);
 }
開發者ID:assurrussa,項目名稱:grid-view-vue,代碼行數:28,代碼來源:GridView.php

示例6: paging

 /**
  * Datatable paging
  *
  * @return null
  */
 protected function paging()
 {
     if (!is_null($this->input['start']) && !is_null($this->input['length']) && $this->input['length'] != -1) {
         $this->query->skip($this->input['start'])->take((int) $this->input['length'] > 0 ? $this->input['length'] : 10);
     }
 }
開發者ID:khaidirh,項目名稱:laravel4-datatables-package,代碼行數:11,代碼來源:Datatables.php

示例7: getItems

 public function getItems($limit, $offset)
 {
     $total = $this->query->getQuery()->getCountForPagination();
     $pageOfItems = $this->query->skip($offset)->take($limit)->get();
     return [$pageOfItems, $total];
 }
開發者ID:nhusby,項目名稱:mason-laravel,代碼行數:6,代碼來源:EloquentContainer.php

示例8: scopeOffset

 /**
  * Offset the results
  *
  * @param  \Illuminate\Database\Eloquent\Builder $query
  * @param  int                                   $offset
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function scopeOffset(Builder $query, $offset)
 {
     return $query->skip($offset);
 }
開發者ID:khaliqgant,項目名稱:Deep,代碼行數:11,代碼來源:Category.php

示例9: skip

 /**
  * Skip a certain amount of rows
  *
  * @param  integer $skip
  * @return $this
  */
 public function skip($skip)
 {
     $this->builder = $this->builder->skip($skip);
     return $this;
 }
開發者ID:kodebyraaet,項目名稱:pattern,代碼行數:11,代碼來源:BaseRepository.php

示例10: buildPagination

 /**
  * @param  PaginationParameters $paginationParameters
  * @param  Builder              $query
  * @return Builder
  */
 public function buildPagination(PaginationParameters $paginationParameters, Builder $query)
 {
     $page = $paginationParameters->getPage();
     $limit = $paginationParameters->getLimit();
     return $query->skip($limit * ($page - 1))->take($limit);
 }
開發者ID:team-ccsad,項目名稱:project-101,代碼行數:11,代碼來源:EloquentPaginatable.php


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