Closed Altffenser closed 4 months ago
Weird thing, using dd($info["event"])
does work (or at least it does something).
You can't just return the Action, you need to mount it.
If you're trying to mount a different action onEventClick, simply create a new action in your livewire class, such as:
public function customAction() {
return Action::make('custom`)
->requiresConfirmation()
// Whatever else you want to do with the action
;
}
and remove your onEventClick function (don't override it). You simply override the $defaultEventClickAction
and set it to your new action:
protected ?string $defaultEventClickAction = 'custom';
Just make sure to handle the authorization in the authorize
method, the ability
parameter will be the name of the action. For testing purposes you can just return true, but on production you should make sure that the user is allowed to perform the action.
EDIT:
But if you only want to add a confirmation dialog to the deleteAction, you can just override the deleteAction
method and modify the DeleteAction there.
You can't just return the Action, you need to mount it.
If you're trying to mount a different action onEventClick, simply create a new action in your livewire class, such as:
public function customAction() { return Action::make('custom`) ->requiresConfirmation() // Whatever else you want to do with the action ; }
and remove your onEventClick function (don't override it). You simply override the
$defaultEventClickAction
and set it to your new action:protected ?string $defaultEventClickAction = 'custom';
Just make sure to handle the authorization in the
authorize
method, theability
parameter will be the name of the action. For testing purposes you can just return true, but on production you should make sure that the user is allowed to perform the action.EDIT:
But if you only want to add a confirmation dialog to the deleteAction, you can just override the
deleteAction
method and modify the DeleteAction there.
Thank you for the time. You're amazing! Solved.
What feature would you like to add?
I would like to display a custom modal, either by passing the view as an instruction or by triggering with Livewire's
dispatch()
method.The problem is that I get neither, the
onEventClick()
event somehow fails to execute the instruction. I have tried with:and (example from Filament Doc.):
Nothing is happens. Some help is appreciable.
Notes
No response