Skip to content
Icon

WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.

White listing columns

Sorting and searching will only work on columns explicitly defined as whitelist.

use DataTables;
 
Route::get('user-data', function() {
$model = App\User::query();
 
return DataTables::eloquent($model)
->whitelist(['name', 'email'])
->toJson();
});