F
Filament3mo ago
andis

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?
Solution:
There's also ->authorize()
Jump to solution
3 Replies
Lara Zeus
Lara Zeus3mo ago
is it a Livewire component with action or a table action? I guess the first case you can do @can on the blade
Solution
Dennis Koch
Dennis Koch3mo ago
There's also ->authorize()
andis
andis3mo ago
Looks like ->authorize() is what I need. I can't seem to find it documented however. Unless im missing it.
Want results from more Discord servers?
Add your server