Filament Studio provides a hook system for extending behavior at key lifecycle points and modifying dynamically generated schemas.
Fired when a new collection is created:
FilamentStudioPlugin::afterCollectionCreated(function (StudioCollection $collection) {
// Seed default fields, send notifications, sync external systems
Notification::send($admins, new CollectionCreatedNotification($collection));
});
Fired when a new field is added to a collection:
FilamentStudioPlugin::afterFieldAdded(function (StudioField $field) {
// Validate constraints, trigger data sync, update search index
Log::info("Field '{$field->label}' added to collection #{$field->collection_id}");
});
Fired when a new tenant is created (instance-level hook):
FilamentStudioPlugin::make()
->afterTenantCreated(function (Model $tenant) {
CollectionSeeder::seedForTenant($tenant->id, [...]);
});
These hooks let you modify the dynamically generated forms, tables, and queries for all collections.
Add, remove, or reorder form components:
FilamentStudioPlugin::modifyFormSchema(function (array $schema, StudioCollection $collection) {
// Add a custom component at the end
$schema[] = Section::make('Metadata')
->schema([
Placeholder::make('id')->content(fn ($record) => $record?->uuid),
]);
return $schema;
});
Add, remove, or reorder table columns:
FilamentStudioPlugin::modifyTableColumns(function (array $columns, StudioCollection $collection) {
// Add a computed column
$columns[] = TextColumn::make('age')
->label('Days Old')
->getStateUsing(fn ($record) => $record->created_at->diffInDays());
return $columns;
});
Apply global scopes or filters to all collection queries:
FilamentStudioPlugin::modifyQuery(function ($query) {
// Only show records created in the last 30 days
return $query->where('created_at', '>=', now()->subDays(30));
});
For testing or reinitialization, all static hooks can be reset:
FilamentStudioPlugin::resetHooks();
The RecordVersioningObserver listens to StudioRecord update events and creates version snapshots when versioning is enabled. See Record Versioning for details.
How can I help you explore Laravel packages today?