getModels() public method

Get the hydrated models without eager loading.
public getModels ( array $columns = ['*'] ) : Model[]
$columns array
return Model[]
示例#1
0
 /**
  * @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
0
 /**
  * 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);
 }
 /**
  * @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
0
 /**
  * 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);
 }