LMongo\Eloquent\Builder::eagerLoadRelations PHP Method

eagerLoadRelations() public method

Eager load the relationships for the models.
public eagerLoadRelations ( array $models ) : array
$models array
return 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;
    }