PHP code example of digital-creative / table-widget

1. Go to this page and download the library: Download digital-creative/table-widget 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 / table-widget example snippets


use DigitalCreative\NovaDashboard\Filters;
use DigitalCreative\TableWidget\TableWidget;

class UsersWidget extends TableWidget
{
    public function fields(): array
    {
        return [
            Text::make('Name'),
            Number::make('Likes'),
            Number::make('Followers'),
        ];
    }

    public function value(Filters $filters): Collection
    {
        return Collection::range(0, 10)->map(function (int $index) {

            return [
                'name' => fake()->name(),
                'likes' => fake()->numberBetween(0, 1000),
                'followers' => fake()->numberBetween(100, 100000),
            ];

        });
    }
}