this is exactly what the permissions package is for
you assign abilities (permissions) to a role then assign one or more roles to a user
then in your code check if the user has the ability to do a certain function. Don't do it by checking the role.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am building a Laravel application and I used the Permission package from Spatie. I created roles such as superadmin, admin, and employee. Both superadmin and admin roles have access to the Admin Dashboard. The employee role has an access to a different dashboard.
The superadmin role is assigned with all permissions. Since the superadmin and admin can access the Admin Dashboard, I want the admin role to have different permissions.
Example:
Admin User 1 => can create, edit, delete employees
Admin User 2 => can create employees only
I can't seem to find a way how to provide different permissions for the role admin. I had to use admin1, admin2 just to provide different permissions. I'm wondering if there is a way to achieve this so when I query the results to display all users with the admin role, I only supply the where clause with role admin and not admin1, admin2, etc. I am aware of providing direct specific permissions to users but I want it to incorporate with the role admin as well.
Thank you in advance.
Please or to participate in this conversation.