src/Routing/VersionedHelpers.php
protected function transformWith($instance, string $name, array $options = [])
    {
        $transformer = $this->getVersionedResourceClassName('Transformers', $name);

        if (\class_exists($transformer)) {
            $transformer = \resolve($transformer);

            if ($transformer instanceof Transformer) {
                return $transformer->options($options)->handle($instance);
            }

            if ($transformer instanceof BaseTransformer) {
                return $transformer->handle($instance);
            }

            return $instance->transform($transformer);
        }

        return $instance;
    }
protected function transformWith($instance, string $name, array $options = [])
    {
        $transformer = $this->getVersionedResourceClassName('Transformers', $name);

        if (\class_exists($transformer)) {
            $transformer = \resolve($transformer);

            if ($transformer instanceof Transformer) {
                return $transformer->options($options)->handle($instance);
            }

            if ($transformer instanceof BaseTransformer) {
                return $transformer->handle($instance);
            }

            return $instance->transform($transformer);
        }

        return $instance;
    }
protected function transformWith ( $ instance , string $ name , array $ options = [ ] ) { $ transformer = $ this -> getVersionedResourceClassName ( 'Transformers' , $ name ) ; if ( \ class_exists ( $ transformer ) ) { $ transformer = \ resolve ( $ transformer ) ; if ( $ transformer instanceof Transformer ) { return $ transformer -> options ( $ options ) -> handle ( $ instance ) ; } if ( $ transformer instanceof BaseTransformer ) { return $ transformer -> handle ( $ instance ) ; } return $ instance -> transform ( $ transformer ) ; } return $ instance ; }
Transform the instance.

@param  \Orchestra\Model\Eloquent|\Illuminate\Support\Collection  $instance
@param  string  $name
@param  array  $options

@return mixed
Transform the instance .