本文整理匯總了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);
}