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
My blade file
It shows the action but doesn't work.
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');
}),
];
}
<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>
1 Reply
Any Idea about this