當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。