Action run code and open url in new tab

Is there a way, to open a new tab in the action method of an (Table-)Action? Something like this:
Action::make("action")
->action(function ($record, Action $action) {
// run some code and then open a new tab with the url generated from the code
})
Action::make("action")
->action(function ($record, Action $action) {
// run some code and then open a new tab with the url generated from the code
})
I know, there is the method url, but I wanna run the code only, when the user clicks on the button. The action will generate a token (and save it to db) and the token will be attached to the url. Since I wanna have a new tab, redirect isn't an option. Is there a way, to just call JS on an action?
1 Reply
Patrick Boivin
Patrick Boivin15mo ago
I suppose you can emit an event from the action, and from JS call window.open() or something equivalent
Want results from more Discord servers?
Add your server