Donations Appreciated

You have not lived today until you have done something for someone who can never repay you. - John Bunyan

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

EloquentController.php - Count Alias

Id Name Email # of Post Created At Updated At


    public function getCount()
        return view('datatables.eloquent.count');

    public function getCountData()
        $users = User::select([
            \DB::raw('count(posts.user_id) as count'),

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


        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
            {data: 'id', name: ''},
            {data: 'name', name: ''},
            {data: 'email', name: ''},
            {data: 'count', name: 'count', searchable: false},
            {data: 'created_at', name: 'users.created_at'},
            {data: 'updated_at', name: 'users.updated_at'}