Installation:
composer require lartisan/filament-architect
Publish the package configuration:
php artisan vendor:publish --provider="Lartisan\FilamentArchitect\FilamentArchitectServiceProvider"
First Use Case:
Check config/filament-architect.php for:
created_at → date)Wizard-Driven Creation:
Field Customization:
required|email).sortable, searchable).state() or visible() closures.Post-Generation:
app/Filament/Resources/{ResourceName}Resource.php:
public static function table(Table $table): Table
{
return parent::table($table)
->columns([
// Custom columns...
]);
}
Existing Models: Use the "Generate Resource for Existing Model" option to scaffold a Filament resource around an existing Eloquent model.
Custom Fields:
Register custom Filament fields in config/filament-architect.php under custom_fields:
'custom_fields' => [
'rich_editor' => \Filament\Forms\Components\RichEditor::class,
],
Testing: Use Pest/Livewire to test generated resources:
use function Pest\Livewire\livewire;
it('creates a record', function () {
livewire(ListPosts::class)
->call('create', ['title' => 'Test', 'body' => 'Content'])
->assertSee('Test');
});
Naming Conflicts:
table, resource) for model/field names. The wizard validates these but may miss edge cases.Relationship Mismatches:
hasMany relationship, ensure the inverse belongsTo exists in the related model. Architect won’t auto-create it.API Resource Overrides:
generate_api_resource: false) won’t remove existing API routes. Manually delete them if needed.Wizard Stuck?: Clear Filament’s cache:
php artisan filament:cache-reset
Then retry the wizard.
Field Not Rendering:
Check config/filament-architect.php for field mappings. Example:
'field_mappings' => [
'boolean' => 'toggle',
'text' => 'text_input',
],
Custom Steps: Add a new step to the wizard by publishing the views:
php artisan vendor:publish --tag="filament-architect-views"
Then extend app/Views/vendor/filament-architect/steps/{step}.blade.php.
Post-Generation Hooks:
Use the generated event in EventServiceProvider:
public function boot()
{
FilamentArchitect::generated(function (Resource $resource) {
// Add custom logic (e.g., register policies)
});
}
Field Presets:
Define reusable field configurations in config/filament-architect.php:
'field_presets' => [
'user' => [
'name' => ['type' => 'text', 'required' => true],
'email' => ['type' => 'email', 'rules' => 'required|email'],
],
],
Select presets during the wizard.
Bulk Generation:
Use the --batch flag in config to generate multiple resources at once (e.g., for all models in a namespace):
'batch' => [
'enabled' => true,
'namespace' => 'App\Models',
],
Dark Mode: Architect respects Filament’s dark mode setting. Test in both themes post-generation.
Localization:
Add translations for custom fields in resources/lang/{locale}/filament-architect.php:
return [
'fields' => [
'rich_editor' => 'Rich Text Editor',
],
];
How can I help you explore Laravel packages today?