Donations Appreciated

We only have what we give. - Isabel Allende

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

CollectionController.php - Collection Demo using collection of array 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 getArray()
        return view('datatables.collection.array');

    public function getArrayData()
        $users = new Collection;
        $faker = Faker::create();

        for ($i = 0; $i < 100; $i++) {
                'id'         => $i + 1,
                'name'       => $faker->name,
                'email'      => $faker->email,
                'created_at' => Carbon::now()->format('m-d-Y'),
                'updated_at' => Carbon::now()->format('m-d-Y'),

        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: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'}