burdziakm / filament-generators
A collection of Artisan generators providing clean, modular building blocks for Filament applications.
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/burdziakm/filament-generators
README
A collection of Artisan generators providing clean, modular building blocks for FilamentPHP applications.
Forms
To create a Filament Form class, use the following command:
php artisan make:filament-form Model
Replace Model with the name of your model. For example, if your model is named Car:
php artisan make:filament-form Car
This will generate a new file:
Filament Form [app/Filament/Forms/CarForm.php] created successfully.
With the following template:
<?php namespace App\Filament\Forms; use Filament\Forms\Form; class CarForm { public function build(Form $form): Form { return $form->schema([ // ]); } }
You can then move the form logic from your Resource to this CarForm class and use it like this:
public static function form(Form $form): Form { return app(\App\Filament\Forms\CarForm::class)->build($form); }
Tables
Similarly, you can create Filament Table classes:
php artisan make:filament-table Model
For example:
php artisan make:filament-table Car
This will generate:
Filament Table [app/Filament/Tables/CarsTable.php] created successfully.
With the following template:
<?php namespace App\Filament\Tables; use Filament\Tables\Table; class CarsTable { public function build(Table $table): Table { return $table->columns([ // ]); } }
You can then use it in your Resource file:
public static function table(Table $table): Table { return app(\App\Filament\Tables\CarsTable::class)->build($table); }
✨ Notes
- Form classes end with
Form, Table classes end withTablein plural form. - This package helps keep your Filament Resources clean by separating form and table definitions into dedicated classes.