public function eagerLoadRelations(array $results): array
    {
        foreach ($this->eagerLoads as $name => $constraints) {
            // First, we'll check if the entity map has a relation and just pass if it
            // is not the case

            if (!in_array($name, $this->entityMap->getRelationships())) {
                continue;
            }

            // 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) {
                $results = $this->loadRelation($results, $name, $constraints);
            }
        }

        return $results;
    }
public function eagerLoadRelations(array $results): array
    {
        foreach ($this->eagerLoads as $name => $constraints) {
            // First, we'll check if the entity map has a relation and just pass if it
            // is not the case

            if (!in_array($name, $this->entityMap->getRelationships())) {
                continue;
            }

            // 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) {
                $results = $this->loadRelation($results, $name, $constraints);
            }
        }

        return $results;
    }
public function eagerLoadRelations ( array $ results ) : array { foreach ( $ this -> eagerLoads as $ name => $ constraints ) { // First, we'll check if the entity map has a relation and just pass if it // is not the case if ( ! in_array ( $ name , $ this -> entityMap -> getRelationships ( ) ) ) { continue ; } // 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 ) { $ results = $ this -> loadRelation ( $ results , $ name , $ constraints ) ; } } return $ results ; }
Eager load the relationships on a result set.

@param array $results

@return array
Eager load the relationships on a result set .