Does anyone have a working way to do this?
Laravel Nova 4 - Trigger custom nova action from custom card
I would like to trigger the Laravel Nova custom action from a custom card. I have created custom action according to the documentation. Then I have registered the action in the resource actions. Also, I have created custom card, which I have also added into resource cards. I would like to run the custom action from the card when pressing button. I have tried using following code in Card.vue (when pressing the button):
Nova.$emit('custom-action', {'arg1': 'arg'})
In the action class, I have added listener as follows:
public function listen()
{
return [
'custom-action' => 'handle',
];
}
And I have also defined handle function, which is not important at the moment:
public function handle(ActionFields $fields, Collection $models)
{
return Action::message('Here');
}
The button, however, does not trigger anything. Some help would be appreciated.
Please or to participate in this conversation.