FilamentF
Filament3y ago
giro

Adding an action to a Livewire component

I try this example from documentation:

https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component

But button not open modal windows
I put livewire component in a x-filament-panels::page

<x-filament-panels::page>
    @livewire('featured-image-l-w')
</x-filament-panels::page>


Not error from browser console, and on button push correct(200) network call, with modal html on it, but not show it.

Anybody try it?
Solution
I find where problem is, on this code:

 public function editAction(): Action
    {
        return Action::make('edit')->label('Edit')
            ->form([])
            ->action(fn () => $this->user->delete());
    }
`
function name editAction need to be same that Action:make('edit'). you can't use a diferent action funcition name and make name.

For example this not work:

public function editAction(): Action
    {
        return Action::make('image')->label('Edit')
            ->form([])
            ->action(fn () => $this->user->delete());
    }
Was this page helpful?