I have the following code, but nested PrototypeTransformer returns always empty array:
$objects = Object::all();
$resource = new Fractal\Resource\Collection($objects, function(Object $obj) {
$r = new FractalCollection($obj->prototypez(), new PrototypeTransformer);
$c = $this->fractal->createData($r)->toArray();
//dd($c);
return [
'id' => (int) $obj->id,
'title' => $obj->prefix,
'prototypes' => $c
;
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire