![]()
WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.
Hide attributes from Json
When you are working with Eloquent Object, you can apply the makeHidden()
(Laravel documentation) function before converting your object toArray().
It can prevent overriding attributes to be compute and increase the performance of converting the object into an array.
use DataTables; Route::get('user-data', function() { $model = App\User::with('posts.comment')->query(); return DataTables::eloquent($model) ->makeHidden('posts') ->toJson();});