I'm using laravel 8 and fractal library.
I want to remove data
property result of fractal with DataArraySerializer
:
use League\Fractal\Serializer\DataArraySerializer;
class TransformerSerializer extends DataArraySerializer
{
public function collection($resourceKey, array $data)
{
return $data;
}
public function item($resourceKey, array $data)
{
return $data;
}
}
my cocde:
$tickets = Ticket::where('user_id', auth()->user()->id)->orderBy('id','desc')->paginate();
$reulst = fractal()
->collection($tickets->getCollection())
->transformWith(new TicketTransformer())
->parseIncludes(['user.profile','status','service'])
->paginateWith(new IlluminatePaginatorAdapter($tickets));
But the result is:
{
"0":{},
"1":{}
}
but I want to have this result:
[
{},
{}
]