PHP code example of shwaeki / laravel-dynamictable

1. Go to this page and download the library: Download shwaeki/laravel-dynamictable 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/ */

    

shwaeki / laravel-dynamictable example snippets


class UsersTable extends DynamicTable
{
    protected string $model = User::class;
}

protected array $features = [
    'views', 'export', 'import',
    'bulk-actions', 'inline_edit',
    'column_picker', 'bulk_edit',
];

protected function columns(): array
{
    return [
        'name',
        'email',
        'department.name' => ['label' => 'Department', 'empty' => 'Unassigned'],
        'status' => ['badges' => ['paid' => 'success', 'overdue' => 'danger']],
        'salary' => ['format' => 'currency:USD', 'align' => 'end'],
        'created_at',
    ];
}

protected array $paramFilters = [
    'status',
    'category' => 'company_category_id',
    'q' => ['column' => 'name', 'operator' => 'contains'],
    'created_period' => ['column' => 'created_at', 'operator' => 'period'],
];
bash
cd demo
composer install
php artisan dynamic-table:demo      # migrate + seed
php artisan serve