src/Execution/DataLoader/ModelRelationFetcher.php
public function getRelationDictionary(string $relationName): array
    {
        return $this->models
            ->mapWithKeys(
                function (Model $model) use ($relationName) {
                    return [$this->buildKey($model->getKey()) => $model->getRelation($relationName)];
                }
            )->all();
    }
public function getRelationDictionary(string $relationName): array
    {
        return $this->models
            ->mapWithKeys(
                function (Model $model) use ($relationName) {
                    return [$this->buildKey($model->getKey()) => $model->getRelation($relationName)];
                }
            )->all();
    }
public function getRelationDictionary ( string $ relationName ) : array { return $ this -> models -> mapWithKeys ( function ( Model $ model ) use ( $ relationName ) { return [ $ this -> buildKey ( $ model -> getKey ( ) ) => $ model -> getRelation ( $ relationName ) ] ; } ) -> all ( ) ; }
Get an associative array of relations, keyed by the models primary key.

@param  string  $relationName
@return mixed[]
Get an associative array of relations keyed by the models primary key .