PHP code example of arkhas / inertia-datatable

1. Go to this page and download the library: Download arkhas/inertia-datatable 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/ */

    

arkhas / inertia-datatable example snippets




namespace App\DataTables;

use App\Models\User;
use Arkhas\InertiaDatatable\EloquentTable;
use Arkhas\InertiaDatatable\InertiaDatatable;
use Arkhas\InertiaDatatable\Columns\Column;
use Illuminate\Http\Request;

class UserDataTable extends InertiaDatatable
{
    protected array $availablePageSizes = [5, 10, 25, 100];

    protected function setup(): void
    {
        $table = new EloquentTable(User::query());
        $table->columns([
            Column::make('id')->label('ID'),
            Column::make('name')->label('Name'),
            Column::make('created_at')->label('Created At'),
        ]);

        $this->table($table);
    }
}