本文整理汇总了PHP中Illuminate\Database\Eloquent\Builder::getModels方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::getModels方法的具体用法?PHP Builder::getModels怎么用?PHP Builder::getModels使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Eloquent\Builder
的用法示例。
在下文中一共展示了Builder::getModels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getModels
/**
* @param array $columns
*
* @return \Illuminate\Database\Eloquent\Model[]
*/
public function getModels($columns = array('*'))
{
if (count($this->query->orders) == 0) {
$this->orderBy(static::COLUMN_MODEL_ID);
}
return parent::getModels($columns);
}
示例2: getModels
/**
* Get the hydrated models without eager loading.
*
* @param array $columns
* @return array|static[]
*/
public function getModels($columns = array('*'))
{
$model = $this->model;
$this->query = $model::callBuildingQueryEvent($this->query);
if (!is_a($this->query, 'Illuminate\\Database\\Query\\Builder')) {
throw new \Exception("\$query must be an instance of \\Illuminate\\Database\\Query\\Builder");
}
$this->builderOrderBy();
return parent::getModels($columns);
}
示例3: getModels
/**
* @param array $columns
* @return \Illuminate\Database\Eloquent\Model[]
*/
public function getModels($columns = ['*'])
{
foreach ($this->eagerLoad as $name => $constraints) {
if ($this->isNestedRelation($name)) {
continue;
}
$relation = $this->getRelation($name);
if ($this->isReferencedInQuery($name) && $this->isRelationSupported($relation)) {
$this->disableEagerLoad($name);
$this->addJoinToQuery($name, $this->model->getTable(), $relation);
$this->addNestedRelations($name, $relation);
$query = $relation->getQuery()->getQuery();
$wheres = $query->wheres;
$bindings = $query->getBindings();
$this->mergeWheres($wheres, $bindings);
}
}
$this->selectFromQuery($this->model->getTable(), '*');
return parent::getModels($columns);
}
示例4: getModels
/**
* Get the hydrated models without eager loading.
*
* @param array $columns
* @return \Illuminate\Database\Eloquent\Model[]
* @static
*/
public static function getModels($columns = array())
{
return \Illuminate\Database\Eloquent\Builder::getModels($columns);
}