You can determine if a role has a certain permission:
$role->hasPermissionTo('edit articles');
A permission can be revoked from a role:
$role->revokePermissionTo('edit articles');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
hi,
I am using spatie permission. I want to delete a 'permission' from permission table.
Before deleting, i want to check that whether this permission is linked with any 'role'. How is it possible.
And if it is linked with any role , i want to stop the deletion or
first delete the the permission from roles and then delete the permission.
Please or to participate in this conversation.