当前位置: 首页>>代码示例>>PHP>>正文


PHP Builder::skip方法代码示例

本文整理汇总了PHP中Illuminate\Database\Query\Builder::skip方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::skip方法的具体用法?PHP Builder::skip怎么用?PHP Builder::skip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Query\Builder的用法示例。


在下文中一共展示了Builder::skip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build

 /**
  * flush events, build pagination and sort items
  * 
  * @return $this
  */
 public function build()
 {
     BurpEvent::flush('dataset.sort');
     BurpEvent::flush('dataset.page');
     $this->paginator = Paginator::make($this->total_rows, $this->per_page, $this->page);
     $offset = $this->paginator->offset();
     $this->limit($this->per_page, $offset);
     if (is_array($this->source)) {
         //orderby
         if (isset($this->orderby)) {
             list($field, $direction) = $this->orderby;
             array_orderby($this->source, $field, $direction);
         }
         //limit-offset
         if (isset($this->limit)) {
             $this->source = array_slice($this->source, $this->limit[1], $this->limit[0]);
         }
         $this->data = $this->source;
     } else {
         //orderby
         if (isset($this->orderby)) {
             $this->query = $this->query->orderBy($this->orderby[0], $this->orderby[1]);
         }
         //limit-offset
         if (isset($this->per_page)) {
             $this->query = $this->query->skip($offset)->take($this->per_page);
         }
         $this->data = $this->query->get();
     }
     return $this;
 }
开发者ID:faizan31,项目名称:datagrid,代码行数:36,代码来源:DataSet.php

示例2: simplePaginate

 /**
  * Get a paginator only supporting simple next and previous links.
  *
  * This is more efficient on larger data-sets, etc.
  *
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 public function simplePaginate($perPage = null, $columns = array('*'))
 {
     $paginator = $this->query->getConnection()->getPaginator();
     $page = $paginator->getCurrentPage();
     $perPage = $perPage ?: $this->model->getPerPage();
     $this->query->skip(($page - 1) * $perPage)->take($perPage + 1);
     return $paginator->make($this->get($columns)->all(), $perPage);
 }
开发者ID:peintune,项目名称:Ternado,代码行数:17,代码来源:Builder.php

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

示例4: skip

 /**
  * Alias to set the "offset" value of the query.
  *
  * @param int $value
  * @return \Illuminate\Database\Query\Builder|static 
  * @static 
  */
 public static function skip($value)
 {
     return \Illuminate\Database\Query\Builder::skip($value);
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

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

示例6: addLimitQuery

 /**
  * Add limit to query builder
  * @param \Illuminate\Database\Query\Builder $query object is by reference
  */
 protected function addLimitQuery($query)
 {
     if (isset($this->limit)) {
         $query->skip($this->limit['skip'])->take($this->limit['take']);
     }
 }
开发者ID:mreschke,项目名称:repository,代码行数:10,代码来源:DbStore.php

示例7: execute

 public function execute(Builder $query)
 {
     $query->skip($this->getValue());
     return $query;
 }
开发者ID:brenodouglas,项目名称:QueryApi,代码行数:5,代码来源:Offset.php

示例8: paging

 /**
  * Perform pagination
  *
  * @return mixed
  */
 public function paging()
 {
     $this->query->skip($this->request->getStart())->take($this->request->getCount());
 }
开发者ID:mikelmi,项目名称:mks-smart-table,代码行数:9,代码来源:QueryBuilderEngine.php

示例9: getQueryColumns

 /**
  * Return the crud's custom query columns
  *
  * @param Builder $builder
  * @return array
  */
 public static function getQueryColumns(Builder $builder)
 {
     // Get the first result of the query
     $resultSet = $builder->skip(0)->take(1)->get();
     // Get the first line from the result query
     $firstRow = array_shift($resultSet);
     // Convert stdClass $firstRow to array
     $stdClassVars = get_object_vars($firstRow);
     // Return only the column names
     return array_keys($stdClassVars);
 }
开发者ID:laravader,项目名称:cms,代码行数:17,代码来源:Queries.php

示例10: build

 public function build()
 {
     if (is_string($this->source) && strpos(" ", $this->source) === false) {
         //tablename
         $this->type = "query";
         $this->query = $this->table($this->source);
         $this->total_rows = $this->query->count();
     } elseif (is_a($this->source, "\\Illuminate\\Database\\Eloquent\\Model") || is_a($this->source, "\\Illuminate\\Database\\Eloquent\\Builder")) {
         $this->type = "model";
         $this->query = $this->source;
         $this->total_rows = $this->query->count();
     } elseif (is_array($this->source)) {
         $this->type = "array";
         $this->total_rows = count($this->source);
     }
     //exception
     //offset and pagination setup/detect
     $config = array('cid' => $this->cid, 'total_items' => $this->total_rows, 'items_per_page' => $this->per_page, 'num_links' => round($this->num_links / 2), 'hash' => $this->hash, 'url' => $this->url, 'current_page' => $this->current_page);
     $this->pagination = new \Rapyd\Helpers\Pagination($config);
     $offset = $this->pagination->offset();
     $this->limit($this->per_page, $offset);
     //build orderby urls
     $this->orderby_uri_asc = $this->app->url->remove('pag' . $this->cid)->remove('reset' . $this->cid)->append('orderby' . $this->cid, array("-field-", "asc"))->get() . $this->hash;
     $this->orderby_uri_desc = $this->app->url->remove('pag' . $this->cid)->remove('reset' . $this->cid)->append('orderby' . $this->cid, array("-field-", "desc"))->get() . $this->hash;
     //detect orderby
     $orderby = $this->app->url->value("orderby" . $this->cid);
     if ($orderby) {
         $this->orderby_field = $orderby[0];
         $this->orderby_direction = $orderby[1];
         $this->orderby($this->orderby_field, $this->orderby_direction);
     }
     //build subset of data
     switch ($this->type) {
         case "array":
             //orderby
             if (isset($this->orderby)) {
                 list($field, $direction) = $this->orderby;
                 $column = array();
                 foreach ($this->source as $key => $row) {
                     $column[$key] = $row[$field];
                 }
                 if ($direction == "asc") {
                     array_multisort($column, SORT_ASC, $this->source);
                 } else {
                     array_multisort($column, SORT_DESC, $this->source);
                 }
             }
             //limit-offset
             if (isset($this->limit)) {
                 $this->source = array_slice($this->source, $this->limit[1], $this->limit[0]);
             }
             $this->data = $this->source;
             break;
         case "query":
         case "model":
             //orderby
             if (isset($this->orderby)) {
                 $this->query = $this->query->orderBy($this->orderby[0], $this->orderby[1]);
             }
             //limit-offset
             if (isset($this->limit)) {
                 $this->query = $this->query->skip($this->pagination->offset())->take($this->per_page);
             }
             $this->data = $this->query->get();
             break;
     }
     return $this;
 }
开发者ID:yash19970,项目名称:rapyd-framework,代码行数:68,代码来源:DataSet.php


注:本文中的Illuminate\Database\Query\Builder::skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。