Do I have to authorize manually in the `->action()` method as well?
I have the following code to change the status on a record:
Do I have to authorize inside the action method on top of the
->authorize()
method on the action itself?Solution:Jump to solution
Authorize is a livewire controller check for permissions.
As you are adding an action it's not possible for it to be run unless it's visible.. You can't hit the action serverside without it being visible and mounted on the page. You are thinking more of functions you can action from a url/post request. So as visible is always false, they would have to somehow bypass the visiblity to show it, for livewire to register/mount it....
4 Replies
Where did you get authorize from? That's usually on the mount function, I suspect you want visible:
Which is all you need?
hmm good question, I swear
authorize
was documented but now I don't see it. Regardless, visible will only do the client side while I think I'd still need it in the action for server side in case a malicious user hit the API in another way right?Solution
Authorize is a livewire controller check for permissions.
As you are adding an action it's not possible for it to be run unless it's visible.. You can't hit the action serverside without it being visible and mounted on the page. You are thinking more of functions you can action from a url/post request. So as visible is always false, they would have to somehow bypass the visiblity to show it, for livewire to register/mount it.
Thanks!