src/Transformers/Concerns/HasRelationships.php
public function relations(array $requested = []): array
    {
        $requested = $this->normalizeRelations($requested);
        $relations = $this->applyQueryConstraints($this->extractRelations($requested));
        $nestedRelations = $this->nestedRelations($requested, $relations, 'relations');

        return array_merge($relations, $nestedRelations);
    }
public function relations(array $requested = []): array
    {
        $requested = $this->normalizeRelations($requested);
        $relations = $this->applyQueryConstraints($this->extractRelations($requested));
        $nestedRelations = $this->nestedRelations($requested, $relations, 'relations');

        return array_merge($relations, $nestedRelations);
    }
Get a list of whitelisted relations that are requested, including nested relations.

@param  array $requested
@return array