F
Filament16mo 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>
<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')...
Jump to solution
2 Replies
krekas
krekas16mo ago
And where's the code for your action?
Solution
giro
giro16mo ago
I find where problem is, on this code:
public function editAction(): Action
{
return Action::make('edit')->label('Edit')
->form([])
->action(fn () => $this->user->delete());
}
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());
}
public function editAction(): Action
{
return Action::make('image')->label('Edit')
->form([])
->action(fn () => $this->user->delete());
}
Want results from more Discord servers?
Add your server