Donations Appreciated

The simplest acts of kindness are by far more powerful then a thousand heads bowing in prayer. - Mahatma Gandhi

Click here to lend your support to: Laravel Datatables and make a donation at !

EloquentController.php - Add|Edit|Remove Column

Id Name Email Created At Updated At Action


    public function getAddEditRemoveColumn()
        return view('datatables.eloquent.add-edit-remove-column');

    public function getAddEditRemoveColumnData()
        $users = User::select(['id', 'name', 'email', 'password', 'created_at', 'updated_at']);

        return Datatables::of($users)
            ->addColumn('action', function ($user) {
                return '<a href="#edit-'.$user->id.'" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>';
            ->editColumn('id', 'ID: {{$id}}')


        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            {data: 'id', name: 'id'},
            {data: 'name', name: 'name'},
            {data: 'email', name: 'email'},
            {data: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'},
            {data: 'action', name: 'action', orderable: false, searchable: false}