Donations Appreciated

It's not how much we give but how much love we put into giving. - Mother Teresa

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

CollectionController.php - Collection Demo using collection of object as data source

Heads Up! Data used here are random using faker. Filtering/sorting results data will be on a luck basis

Id Name Email Created At Updated At


    public function getObject()
        return view('datatables.collection.object');

    public function getObjectData()
        $faker = Faker::create();
        $data  = [];
        for ($i = 0; $i < 100; $i++) {
            $obj = new \stdClass;
            $obj->id = $i + 1;
            $obj->name = $faker->name;
            $obj->email = $faker->email;
            $obj->created_at = Carbon::now();
            $obj->updated_at = Carbon::now();
            $data[] = $obj;
        $users = new Collection($data);

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


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