F
Filamentβ€’5mo ago
d3v1anX

Open modal after page load

Hey guys, I have a table which has only modal (slideOver) to edit / create entries. Now I'd like to create a button from another resource to the target resource and open directly after loading the "create" modal. My code until now:
protected function getHeaderActions(): array
{
return [
Actions\Action::make('invite_user')
->label(__('Teammitglied einladen'))
->button()
->icon('heroicon-o-plus-circle')
->url(InvitationResource::getUrl('index', ['create' => true]))
,
];
}
protected function getHeaderActions(): array
{
return [
Actions\Action::make('invite_user')
->label(__('Teammitglied einladen'))
->button()
->icon('heroicon-o-plus-circle')
->url(InvitationResource::getUrl('index', ['create' => true]))
,
];
}
if I try to "create" instead of index it shows an error, because the route does not exists. -> its just a modal πŸ™‚ Has anyone an idea? Maybe I can react on the parameter and open the modal somehow after loading the table?
Solution:
got it πŸ™‚ instead of ```php ->url(InvitationResource::getUrl('index', ['create' => true]))...
Jump to solution
1 Reply
Solution
d3v1anX
d3v1anXβ€’5mo ago
got it πŸ™‚ instead of
->url(InvitationResource::getUrl('index', ['create' => true]))
->url(InvitationResource::getUrl('index', ['create' => true]))
just
->url(InvitationResource::getUrl('index', ['action' => 'create']))
->url(InvitationResource::getUrl('index', ['action' => 'create']))
Want results from more Discord servers?
Add your server