Is there's a way to use Laravel resource Collections instead of transformers
$data = Sport::select(['id', 'title', 'icon', 'status_id', 'updated_at'])
->with('status:id,status')
->withCount('users');
return DataTables::make($data)
->setTransformer(new SportTransformer())
->toJson();
if @yajra accepts my PR you'll be able to do at least:
DataTables::eloquent($query)
->setTransformer(function ($item){
return Resource::make($item)->resolve();
})
->make();
The feature is released in yajra/laravel-datatables-fractal v1.3.0
thnx @yajra
Most helpful comment
The feature is released in yajra/laravel-datatables-fractal v1.3.0
thnx @yajra