Skip to content

Generating Tables

You can create a new Table class by using the make:inertia-table Artisan command. This command will create a new Table class in the App\Tables namespace. The command will try to guess the Eloquent Model name based on the table name.

bash
php artisan make:inertia-table Users

This is what the generated Table class looks like:

php
<?php

namespace App\Tables;

use App\Models\User;
use InertiaUI\Table\Action;
use InertiaUI\Table\Columns;
use InertiaUI\Table\Filters;
use InertiaUI\Table\Table;

class Users extends Table
{
    protected ?string $resource = User::class;

    public function columns(): array
    {
        return [
            //
        ];
    }

    public function filters(): array
    {
        return [
            //
        ];
    }

    public function actions(): array
    {
        return [
            //
        ];
    }

    public function exports(): array
    {
        return [
            //
        ];
    }
}