Action not triggering

I have a simple Livewire Component:
class UserIcon extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function userMenuOrLogin(): Action
{
return Action::make('login')
->action(function (array $arguments) {
dd('Test action called', $arguments);
});
}


public function render(): View
{
return view('livewire.user-icon');
}
}
class UserIcon extends Component implements HasForms, HasActions
{
use InteractsWithActions;
use InteractsWithForms;


public function userMenuOrLogin(): Action
{
return Action::make('login')
->action(function (array $arguments) {
dd('Test action called', $arguments);
});
}


public function render(): View
{
return view('livewire.user-icon');
}
}
and thats the view:
<div>
{{ $this->userMenuOrLogin }}
<x-filament-actions::modals />
</div>
<div>
{{ $this->userMenuOrLogin }}
<x-filament-actions::modals />
</div>
When I click on the button, I can see the update request on the network tab of chrome, but nothing happens, no DD output is shown. Any ideas?
2 Replies
awcodes
awcodes3w ago
Your function name needs ‘Action’ and the name of the action itself needs to match. function deleteAction() Action::make(‘delete’)
bernhard
bernhardOP3w ago
Thanks. Its even in the docs. I am so stupid 😄
Want results from more Discord servers?
Add your server