src/TransformBuilder.php
protected function prepareRelations($data, $transformer)
    {
        if ($transformer instanceof Transformer) {
            $relations = $transformer->relations($this->with);
            $defaultRelations = $this->removeExcludedRelations($transformer->defaultRelations($this->with));
            $this->with = array_merge($relations, $defaultRelations);
        }

        if ($data instanceof Model || $data instanceof Collection) {
            $this->eagerLoadRelations($data, $this->with, $transformer);
        }

        $this->with = array_keys($this->with);
    }
protected function prepareRelations($data, $transformer)
    {
        if ($transformer instanceof Transformer) {
            $relations = $transformer->relations($this->with);
            $defaultRelations = $this->removeExcludedRelations($transformer->defaultRelations($this->with));
            $this->with = array_merge($relations, $defaultRelations);
        }

        if ($data instanceof Model || $data instanceof Collection) {
            $this->eagerLoadRelations($data, $this->with, $transformer);
        }

        $this->with = array_keys($this->with);
    }
Prepare requested relations for the transformation.

@param  mixed                                                          $data
@param  \Flugg\Responder\Transformers\Transformer|callable|string|null $transformer
@return void