Donations Appreciated

When we give cheerfully and accept gratefully, everyone is blessed. - Maya Angelou

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

EloquentController.php - Basic Demo with Column Definition

IMPORTANT: When using make(), the package will rely filtering and sorting based on the index/arrangement of your select query.

NEVER USE SELECT(*) when using this approach or your DataTables filtering/sorting may not work properly.

Id Name Email Created At Updated At


    public function getBasicObject()
        return view('datatables.eloquent.basic-columns');

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

        return Datatables::of($users)->make();


        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            {data: 0, name: 'id'},
            {data: 1, name: 'name'},
            {data: 2, name: 'email'},
            {data: 3, name: 'created_at'},
            {data: 4, name: 'updated_at'}