DEV Community

saeed abdollahian
saeed abdollahian

Posted on Edited on

New and Optimized role and permission package for Laravel 11/12

A highly optimized role and permission package for Laravel 11/12 with advanced features including multiple guards, wildcard permissions, super admin, expirable permissions, expirable roles, and Laravel Gate integration.

composer require saeedvir/laravel-permissions

Enter fullscreen mode Exit fullscreen mode

See Document

Star This Package

✅ Role-based Access Control (RBAC)
✅ Permission Management
✅ Direct User Permissions
✅ Works with any model Advanced Features

🚀 Multiple Guards Support - Separate permissions for web, api, admin
🎯 Wildcard Permissions - Use posts.* to grant all post permissions
👑 Super Admin Role - Automatically has ALL permissions
⏰ Expirable Permissions - Set expiration dates on permissions
⏰ Expirable Roles - Set expiration dates on roles

Top comments (1)

Collapse
 
mehedirafi profile image
Mehedi Mansur Rafi •

The structure I reuse on every admin panel is small on purpose:

  1. A roles table (admin, staff, viewer, or whatever the project calls them) and a user role link. One role per user is enough for most small systems; add many to many only when a real case shows up.
  2. Permission checks at the route level with middleware, so a staff account cannot open an admin URL by typing it. Hiding the menu button is not security.
  3. One super admin role that passes every check, used only by the owner account.
  4. A second test account for each role. Log in as staff and try to open the admin pages directly. If any of them load, the middleware is in the wrong place.

Step 4 is the one people skip, and it is the one that finds the holes.