FilamentF
Filament8mo ago
Asmit

Help: 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 {
                  //
                }),
        ];
    }

In blade file:
   @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 ?
Screenshot_2025-04-28_at_13.01.08.png
Solution
@dvarilek Thanks for reply,
I just solved it with this ✅
 $this->livewire->cacheAction($action);
Was this page helpful?