Public method [mountAction] not found on component when adding an action to Livewire component.
Hi.
I'm trying to add an action to Livewire component like mentioned in documentation : https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component. I've got the following error :
Unable to call component method. Public method [mountAction] not found on component
.
public function goLiveAction(): Action
{
return Action::make('goLiveAction')
->label('Passer en production')
->requiresConfirmation()
->modalWidth('lg')
->modalHeading('Passage en Production')
->action(function () {
})
->hidden(fn() => $this->merchant->in_live_mode);
}
<x-page.merchant :$merchant :breadcrumbs="$this->breadcrumbs">
<x-slot:headerActions>
@if ($this->goLiveAction->isVisible())
{{ $this->goLiveAction }}
@endif
</x-slot:headerActions>
<x-filament-actions::modals/>
</x-page.merchant>
3 Replies
Same here! Were you able to do this?
Code looks ok. Make sure you are importing all the necessary traits and interfaces and that your view is also including the modals component.
You were right, I needed to add the traits and interfaces. Thanks!