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

Eluknow's avatar

Users, roles, permissions, forums

Hi ! Tonight I've a lot of questions, sorry :p.

So, I just wondered how to organize my tables and my models in order to do the following thing :

  • I've users, who can belong to roles that have some permissions (update profile, add user, for instance). Here, I know how to do.
  • But I've also something like "forums", indeed some website's parts where roles haven't got the same permissions in each parts. For exemple, the role called "foo" can see the part "bar" and write in this part. But he cannot see "bar2" part. So, I've to find an architecture that allows me to give some permissions for some roles AND that allows me to give some permissions based on the parts for some roles... Am i understandable ? :p.

I'm going to try to explain more briefly : How to organize my tables and models in order to give to roles different permissions based on the part. A role can have the permission to update profile / add user AND to see some parts / write in some parts. So, the main problem is that I cannot create a permission called "see" because a role could has the right to see a part but doesn't be allow to see another part. I've some "fixed" permissions (add user, delete user etc) and some permissions that depend on the part.

Have you got any idea to solve the problem ? Thanks a lot !

0 likes
1 reply
Eluknow's avatar

With LaravelSD http://www.laravelsd.com/582c6274d9a6f , I represented what I have and how I imagine my structure. But, what's the Laravel's relationship that will able me to retrieve the permissions for foo role and for bar forum ?

Because in fact, the "forums_permission" table contains the permission, but each forum has different permissions. So, there are some forum's permissions for each role and each forum.

Does someone know what's the relationship I need ?

Please or to participate in this conversation.