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

elivnjak's avatar

ACL - Different roles for different schools

I'm fairly new to Laravel and been looking all over for this answer but not able to find anything that fits my requirements.

Basically I want the ability for a single login user to be assigned multiple roles based a specific school.

So for example:

School A: The User is student School B: The User is Manager School C: The User is a manager and Teacher

Ideally in the UI, a user can login and then switch between the schools he is registered to. Then depending on what school he chooses he will possibly be a different role (Teacher, Student, Manager).

I have also been looking at morphing but not sure if that's the right solution because of the fact that I want the ability for a user to possibly have multiple roles assigned to a particular school.

Thanks in advance

0 likes
3 replies
vajid's avatar

Use middleware and apply it to any school route you want ACL

in middleware you can fetch the role from acl_table

user_id school_id role_id
1       1       1
1       2       2

and save it in session

and depending on this session variable you can restrict user

elivnjak's avatar

Hi @vajid Thanks for the reply. Just wondering if i can get some guidance as to how i would implement the models?

Please or to participate in this conversation.