Multiple actions on livewire page through loop

I want to render multiple action on livewire page, dynamically I have this method on livewire class,
protected function getActions(): array
{
return [
Action::make('Create')
->modal()
->form([
TextInput::make('name')
->required()
->default('john'),
])
->action(function (array $data): void {
//
);

}),
Action::make('Generate')
->lavel('Regenerate')
->modal()
->form([
TextInput::make('name')
->required()
->default($this->getOwnerRecord()->getKey()),
])
->action(function (array $data): void {
//
}),
];
}
protected function getActions(): array
{
return [
Action::make('Create')
->modal()
->form([
TextInput::make('name')
->required()
->default('john'),
])
->action(function (array $data): void {
//
);

}),
Action::make('Generate')
->lavel('Regenerate')
->modal()
->form([
TextInput::make('name')
->required()
->default($this->getOwnerRecord()->getKey()),
])
->action(function (array $data): void {
//
}),
];
}
In blade file:
@if(method_exists($this, 'headerActions'))
@foreach($this->getActions() as $action)
{{ $action }}
@endforeach
@endif
<x-filament-actions::modals />
@if(method_exists($this, 'headerActions'))
@foreach($this->getActions() as $action)
{{ $action }}
@endforeach
@endif
<x-filament-actions::modals />
The modals are not open, Is there anything that i missed ?
No description
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?