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


PHP Model::query方法代码示例

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


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

示例1: paginated

 /**
  * @param PaginationParameters $paginationParameters
  * @param FilterParameters $filterParameters
  * @param SortParameters $sortParameters
  * @param array $with
  * @return array
  */
 public function paginated(PaginationParameters $paginationParameters, FilterParameters $filterParameters = null, SortParameters $sortParameters = null, $with = [])
 {
     $query = $this->model->query();
     $query->with($with);
     if ($filterParameters) {
         $this->buildFilters($filterParameters, $query);
     }
     if ($sortParameters) {
         $this->buildSorting($sortParameters, $query);
     }
     $total = $query->count();
     $this->buildPagination($paginationParameters, $query);
     return $this->paginate($paginationParameters, $query->get(), $total);
 }
开发者ID:team-ccsad,项目名称:project-101,代码行数:21,代码来源:EloquentRepository.php

示例2: query

 /**
  * Give unexecuted query for current criteria
  *
  * @return EloquentBuilder
  */
 public function query()
 {
     $this->applyCriteria();
     if ($this->model instanceof Model) {
         return $this->model->query();
     }
     return clone $this->model;
 }
开发者ID:czim,项目名称:laravel-repository,代码行数:13,代码来源:BaseRepository.php

示例3: buildChoices

 protected function buildChoices()
 {
     if (!$this->model) {
         return;
     }
     if (is_string($this->model)) {
         $this->model = App::make($this->model);
     }
     $q = $this->model->query();
     if ($this->callback) {
         $this->callback($q);
     }
     $key = $this->key ? $this->key : 'id';
     $field = $this->field ? $this->field : "title";
     $choices = $this->blank ? array('' => $this->blank) : array();
     $choices += $q->lists($field, $key);
     return $choices;
 }
开发者ID:boyhagemann,项目名称:framework,代码行数:18,代码来源:ModelElement.php

示例4: orderBy

 public function orderBy($column, $direction = 'asc')
 {
     $this->model = $this->model->query()->orderBy($column, $direction);
     return $this;
 }
开发者ID:mammutgroup,项目名称:l5-repository,代码行数:5,代码来源:BaseRepository.php

示例5: query

 /**
  * @return Builder
  */
 public static function query()
 {
     return parent::query();
 }
开发者ID:garrinar,项目名称:laravel,代码行数:7,代码来源:Model.php

示例6: query

 /**
  * @param string $text
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function query($text)
 {
     $query = $this->model->query();
     return $query;
 }
开发者ID:tiny96,项目名称:laravel-query-filter,代码行数:10,代码来源:QueryFilter.php

示例7: getDefaultQueryBuilder

 /**
  * @return \Illuminate\Database\Query\Builder|static
  */
 protected function getDefaultQueryBuilder()
 {
     return $this->model->query()->getQuery();
 }
开发者ID:Algatux,项目名称:laravel-repository,代码行数:7,代码来源:AbstractRepository.php

示例8: query

 /**
  * @{@inheritdoc}
  */
 public function query()
 {
     return $this->model->query();
 }
开发者ID:KodiComponents,项目名称:module-core,代码行数:7,代码来源:BaseRepository.php

示例9: filterAll

 /**
  * Return all instances of the model.
  *
  * @param array $columns
  * return \Illuminate\Database\Eloquent\Model
  */
 public function filterAll(array $filters = array(), array $columns = array('*'))
 {
     $query = $this->model->query();
     $query = $this->processFilters($query, $filters);
     return $query;
 }
开发者ID:ritey,项目名称:absolutemini,代码行数:12,代码来源:AbstractRepository.php

示例10: count

 /**
  * Returns number of records in the table
  *
  * @return int
  */
 public function count()
 {
     return $this->model->query()->get()->count();
 }
开发者ID:4ernovm,项目名称:whmcs-orm,代码行数:9,代码来源:Repository.php

示例11: screenModel

 public function screenModel(Model $model)
 {
     $this->query = $model->query();
     return $this->start();
 }
开发者ID:geehare,项目名称:laraval-screen,代码行数:5,代码来源:ScreenEloquent.php

示例12: query

 public function query(Model $model)
 {
     return $model->query();
 }
开发者ID:roshangara,项目名称:datatables-handler,代码行数:4,代码来源:DatatablesHandler.php


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