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