{
$query = Comment::with('user')
->where('model', $model)
->where('model_id', $model_id)
->orderBy('id', 'desc');
return DataTables::of($query->get())
->addColumn('user_roles', function ($comment) {
return $comment->user->getRoleNames()->implode(', ');
})
->toJson();
}
we can add new column to datatable json data using this