We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1dfcbe2 commit 68ac046Copy full SHA for 68ac046
src/Transformer/Factory.php
@@ -192,12 +192,16 @@ public function getTransformerBindings()
192
/**
193
* Set the transformation layer at runtime.
194
*
195
- * @param \Dingo\Api\Contract\Transformer\Adapter $transformer
+ * @param \Closure|\Dingo\Api\Contract\Transformer\Adapter $transformer
196
197
* @return void
198
*/
199
- public function setTransformer(Adapter $transformer)
+ public function setTransformer($transformer)
200
{
201
+ if (is_callable($transformer)) {
202
+ $transformer = call_user_func($transformer, $this->container);
203
+ }
204
+
205
$this->transformer = $transformer;
206
}
207
0 commit comments