Support the ongoing development of Laravel.io →
Authentication Validation Packages
Last updated 3 months ago.
0

highnoon112 said:

The end goal is to have different schools to login on the same website where the head of school, teachers and students can belong to multple schools but have different roles for each particular school they belong too.

So if a teacher logins to School A it will not have the same roles of School B where he is a part of as well.

You can add a flag in the roles table that indicates what school they're from, so your table looks like:

id, title, school_id

Ideally, your Teacher from School B should NOT be able to assign student roles to students from School A. You'll need to make sure the school_id matches when they try to perform an action.

Im not sure how to go at this. I thought I could create a url like this www.example.com/schoolA/ and check the suffix, in this case schoolA, to figure out to which school the user wants to login.

My personal preference is that I don't trust the users to give me the right information. That includes going to the right page. You can have either a pivot table or add into users what school they're from. That way if the UserA from SchoolA googles the login page and accidentally goes to the SchoolB page, they'll still be redirected to the relevant information.

Im hoping this at least hints what I would like to accomplish with the login details for the website. Maybe there is a good starting Authorisation/roles packages?

I think everything in the basic Laravel Authorization package covers everything you need. All you need is either a pivot table that enhances your users to include school information, and your controller/template that displays the correct school information, and you should be all set.

0

Sign in to participate in this thread!

Cloudways

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.