Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hassandev's avatar

Implementing Dual-Level Roles in Laravel App

Hello everyone,

I'm currently developing an application using Laravel and have encountered a challenge with implementing a two-tier role system. I'm using the laravel-permission package but am struggling to configure it to suit my specific needs. Here's a breakdown of the problem:

Background:

My application needs to support two distinct types of roles:

  • Website Roles: These are global roles applicable across the entire platform, such as website admin and website manager.
  • Company Roles: These are specific to each registered company using the app, like company admin, company manager, etc.

The Challenge:

I'm able to use the teams feature in laravel-permission to handle company roles effectively. Each 'team' in this context represents a company, and I can assign roles and permissions within each company. However, the difficulty arises with the website roles. I need a way to manage these website-wide roles independently from the company-specific roles.

What I've Tried:

  • I've set up company roles using the teams feature in laravel-permission, which works well for that part.
  • I'm stuck on implementing the website roles, as they don't fit into the teams feature framework.

What I Need Help With:

I'm looking for advice or suggestions on how to implement this two-tier role system effectively. Specifically, I need guidance on:

  1. Managing website roles separately from company roles.
  2. Best practices for structuring this kind of dual-level role system in Laravel.
  3. Any examples or experiences you may have with a similar setup.

I appreciate any insights or advice you can provide. Thank you in advance for your help!

0 likes
1 reply
jlrdw's avatar

Sounds like a multi tenant app. You can have a prefix or suffix for a company users role.

But do you have multi databases or just one. I suggest look over some of the multi tenant packages if this is what you are doing.

Please or to participate in this conversation.