Multiple actions on livewire page through loop
I want to render multiple action on livewire page, dynamically
I have this method on livewire class,
In blade file:
The modals are not open, Is there anything that i missed ?
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 {
//
}),
];
}
@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 />

0 Replies