Authorize an action
I'm using an action in a Livewire component. I'm trying to authorize the action, for example a user is allowed to delete a model.
I know I can hide or disable the action but that does not stop the 'selectedTableRecords' being changed or the 'mountTableAction' being tampered with.
What is the best way to check the user has authorization to perform the action given the action parameters?
3 Replies
is it a Livewire component with action or a table action?
I guess the first case you can do
@can on the blade
Solution
There's also
->authorize()
Looks like
->authorize()
is what I need. I can't seem to find it documented however. Unless im missing it.