The transform()collection() and item() methods, take an optional transformer instance as the second method. When omitted, the transformer resolver is used to try and find a matching transformer and instantiate it via the laravel app container.
It would be nice if you could pass MyTransformer::class (string) as the second argument, meaning that it should be instantiated via laravel's app container.
public function index()
{
return Smokescreen::transform(User::all(), UserTransformer::class);
}
The
transform()
collection()
anditem()
methods, take an optional transformer instance as the second method. When omitted, the transformer resolver is used to try and find a matching transformer and instantiate it via the laravel app container.It would be nice if you could pass
MyTransformer::class
(string) as the second argument, meaning that it should be instantiated via laravel's app container.