Actions on loop on livewire

I tried to send array of actions on livewire page and try to triggered it but it wont work. My Livewire component method
public function getFooterActions(): array
{
return [
Action::make('save')
->label('Save')
->color('success')
->action(function ($livewire) {
$livewire->dispatch('myRefresh');
$this->dispatch('closeModal');
}),
Action::make('cancel')
->label('Cancel')
->color('gray')
->action(function ($livewire) {
$livewire->dispatch('myRefresh');
$this->dispatch('closeModal');
}),
];
}
public function getFooterActions(): array
{
return [
Action::make('save')
->label('Save')
->color('success')
->action(function ($livewire) {
$livewire->dispatch('myRefresh');
$this->dispatch('closeModal');
}),
Action::make('cancel')
->label('Cancel')
->color('gray')
->action(function ($livewire) {
$livewire->dispatch('myRefresh');
$this->dispatch('closeModal');
}),
];
}
My blade file
<div>
<x-filament::section>
<x-slot name="heading">
Update
</x-slot>
{{ $this->form }}
@foreach($this->getFooterActions() as $action)
{{ $action }}
@endforeach
</x-filament::section>
<x-filament-actions::modals />
</div>
<div>
<x-filament::section>
<x-slot name="heading">
Update
</x-slot>
{{ $this->form }}
@foreach($this->getFooterActions() as $action)
{{ $action }}
@endforeach
</x-filament::section>
<x-filament-actions::modals />
</div>
It shows the action but doesn't work.
1 Reply
Asmit Nepali
Asmit NepaliOP3w ago
Any Idea about this

Did you find this page helpful?