src/Transformers/Concerns/HasRelationships.php
protected function resolveRelation(Model $model, string $identifier)
    {
        $identifier = camel_case($identifier);
        $relation = $model->$identifier;

        if (method_exists($this, $method = 'filter' . ucfirst($identifier))) {
            return $this->$method($relation);
        }

        return $relation;
    }
protected function resolveRelation(Model $model, string $identifier)
    {
        $identifier = camel_case($identifier);
        $relation = $model->$identifier;

        if (method_exists($this, $method = 'filter' . ucfirst($identifier))) {
            return $this->$method($relation);
        }

        return $relation;
    }
Resolve a relation from a model instance and an identifier.

@param  \Illuminate\Database\Eloquent\Model $model
@param  string                              $identifier
@return mixed