Illuminate\Database\Eloquent\Builder::eagerLoadRelations PHP Метод

eagerLoadRelations() публичный Метод

Eager load the relationships for the models.
public eagerLoadRelations ( array $models ) : array
$models array
Результат array
    public function eagerLoadRelations(array $models)
    {
        foreach ($this->eagerLoad as $name => $constraints) {
            // For nested eager loads we'll skip loading them here and they will be set as an
            // eager load on the query to retrieve the relation so that they will be eager
            // loaded on that query, because that is where they get hydrated as models.
            if (strpos($name, '.') === false) {
                $models = $this->loadRelation($models, $name, $constraints);
            }
        }
        return $models;
    }

Usage Example

Пример #1
0
 /**
  * Eager load the relationships for the models.
  *
  * @param array $models
  * @return array 
  * @static 
  */
 public static function eagerLoadRelations($models)
 {
     return \Illuminate\Database\Eloquent\Builder::eagerLoadRelations($models);
 }