PHP code example of digital-creative / nova-data-table

1. Go to this page and download the library: Download digital-creative/nova-data-table library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

digital-creative / nova-data-table example snippets


class ExampleNovaResource extends Resource
{

    public function cards(Request $request)
        {
            return [
                (new NovaDataTable())
                    ->columns(
                        [
                          new Columns('Name', 'name'),
                          new Columns('Age', 'age'),
                          new Columns('Address', 'address'),
                        ]
                    )->data([
                        [
                            'name' => 'Richard Needham',
                            'address' => '9293 South Peachtree Drive Rahway, NJ 07065',
                            'age' => 18
                        ],
                        [
                            'name' => 'Cari Mckenzie',
                            'address' => '8478 Tallwood St.Far Rockaway, NY 11691',
                            'age' => 24,
                        ],
                        [
                            'name' => 'Daniella Connor',
                            'address' => '7674 Hilltop Road Mcdonough, GA 30252',
                            'age' => 33
                        ],
                        [
                            'name' => 'Lamar Mac',
                            'address' => '67 Thorne Circle New Brunswick, NJ 08901',
                            'age' => 44
                        ]
                    ])
                    ->rowLabels([
                        'Label1',
                        'Label2',
                        'Label2',
                        'Label3',
                    ])
            ];
        }

}