本文整理汇总了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);
}
示例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;
}
示例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;
}
示例4: orderBy
public function orderBy($column, $direction = 'asc')
{
$this->model = $this->model->query()->orderBy($column, $direction);
return $this;
}
示例5: query
/**
* @return Builder
*/
public static function query()
{
return parent::query();
}
示例6: query
/**
* @param string $text
*
* @return \Illuminate\Database\Eloquent\Builder
*/
public function query($text)
{
$query = $this->model->query();
return $query;
}
示例7: getDefaultQueryBuilder
/**
* @return \Illuminate\Database\Query\Builder|static
*/
protected function getDefaultQueryBuilder()
{
return $this->model->query()->getQuery();
}
示例8: query
/**
* @{@inheritdoc}
*/
public function query()
{
return $this->model->query();
}
示例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;
}
示例10: count
/**
* Returns number of records in the table
*
* @return int
*/
public function count()
{
return $this->model->query()->get()->count();
}
示例11: screenModel
public function screenModel(Model $model)
{
$this->query = $model->query();
return $this->start();
}
示例12: query
public function query(Model $model)
{
return $model->query();
}