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

polarcubs's avatar

Handling individual and group level permissions. Forum and other stuffs.

Hi,

Currently I'm trying to create a simple forum. There are a few forum categories. Some of the forum categories can only be posted to by teacher.

For now what I do is more of having a forum_categories_permissions table.

In it I specify which roles_id can hang out at which forum category.

Then in my code I do manual checkings. As how I do it for many other parts of my website to see if a user is a teacher or a student, or some other roles before deciding to allow or deny. Either based on their role, or if they are the creator of the item.

But I wonder if there is an easier or better way to manage this. I googled online and saw stuffs like DAC, ACL, RBAC and wonder if they could help me in this task.

0 likes
3 replies
Valcristo's avatar

Hello

i have one problem with this package, i cant attach one role to a user

i really like to know how i can attach role to user with this package, i have one role create but this role how can attach to the user.

this is my store method.

public function store(Admin $request) {

$user = Auth::user()->create($request->all());

$user->attachRole('roles');

return 'esta creado';

}

Please or to participate in this conversation.