How to disable ToggleColumn when user don't have update permission

I have implemented spatie permission package and when the user don't have edit/update permission on any resource the edit button is not visible. However, I have a toggle column in table which updates entries status which is still accessible when user don't have required permission. Can anyone please help how can I make it disabled when the user don't have edit permission.
No description
Solution:
use ```php ->disabled(function($record){ // check for permission }),...
Jump to solution
4 Replies
Solution
Lara Zeus
Lara Zeus13mo ago
use
->disabled(function($record){
// check for permission
}),
->disabled(function($record){
// check for permission
}),
Oumuamua
OumuamuaOP13mo ago
Thanks, How can I access spatie permissions of current logged in user there?
Lara Zeus
Lara Zeus13mo ago
`auth()->user()->->hasRole('writer')
Oumuamua
OumuamuaOP13mo ago
Thanks, it worked perfectly!
Want results from more Discord servers?
Add your server