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

CodeFox's avatar

Architecture Question (user belongs to another user)

Hey

So I'm making a little app just now where I have a bunch of users in my users table. I want there to be three roles and I'll use the Spatie roles/permissions package to do that.

The three roles are:

admin supervisor employee

I want a supervisor to have many employees, and the employee to belong to many supervisors.

Ordinarily that would be pretty obviously a many-to-many relationship but it's all taking place on the single User model. What is the correct way to implement this?

0 likes
1 reply
CodeFox's avatar

Hey @martinbean

It's actually a little complex as an employee may be supervised by many users. Maybe a pivot table would be better, but can you do that for the same model? :/

Please or to participate in this conversation.