zaster's avatar

Multi Auth with Roles and Permissions

I have 4 Separate sections as logins

Admin Login

Vendor Login

Employee Login

User Login

Admin is supposed to create all roles and permissions to these different Type of Users

How should i maintain the roles and permissions tables

Can i have only two tables such as roles and permissions to manage all these User Types

0 likes
3 replies
Snapey's avatar
Snapey
Best Answer
Level 122

Well first, my principle is always, people that are logging in are all users. For Authentication, you only need one user model and one guard.

Once you know who someone is, you can then apply Authorization to determine what they are able to do.

So I would always have one users table, a permissions table and a roles table. Assuming user can then have multiple roles and multiple permissions then you will need pivot tables also.

At this point its best just to choose a package and follow the packages way of doing things

itrabbi24's avatar

Hello Sir, Can I used the 1st package which is 'laratrust' in laravel 5.8?

Please or to participate in this conversation.