Tii
Tii
FFilament
Created by Tii on 10/12/2024 in #❓┊help
Preset attributes according to selected tab/previously created record
I have an Event resource. I display it with tabs filtered for a type, like one tab for type "A", one for type "B" etc. When you click on Create on the top right it should prefill the new record with the type that was previously selected as tab. I achieved this by overwriting this method:
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->url(fn () => route('filament.admin.resources.calendar.events.create', [
'type' => $this->activeTab,
])),
];
}
protected function getHeaderActions(): array
{
return [
CreateAction::make()
->url(fn () => route('filament.admin.resources.calendar.events.create', [
'type' => $this->activeTab,
])),
];
}
When you click on "Create and create another" it should stay that way and in addition to this I'd like to set the start_time of the next record to one week after the one that was just created. I'm not sure how to achieve this. I'm also not sure if there is a better way for the CreateAction.
3 replies