Donations Appreciated

There is no exercise better for the heart than reaching down and lifting people up. - John Holmes

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

EloquentController.php - DataTables with manual count query.

Id Name Email Created At Updated At

EloquentController.php

    public function getManualCount(Request $request)
    {
        if ($request->ajax()) {
            $users = User::query();

            return Datatables::of($users)
                ->setTotalRecords(100)
                ->make(true);
        }

        return view('datatables.eloquent.manual-count');
    }

Javascript

    $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            {data: 'id'},
            {data: 'name'},
            {data: 'email'},
            {data: 'created_at'},
            {data: 'updated_at'}
        ]
    });