![]()
WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.
Only Response
Get only selected columns in response.
use DataTables; Route::get('user-data', function() { $model = App\User::query(); return DataTables::eloquent($model) ->only(['id','name']) ->toJson();});
Example Response
{ "draw": 2, "recordsTotal": 10, "recordsFiltered": 2, "data": [{ "id": 476, "name": "Esmeralda Kulas" }, { "id": 6, "name": "Zachery Muller" }]}