I want to use Laravel native multi-auth for many types of user like students, schools, and admins.
I have 5 tables for this like:
I am struggling a long time for this. Can anyone give me the idea, how to acheive this? Thanks in advance.
The difference is that I am storing email/passwords for all users in the "user" table and other information in their respective tables.
答案 0 :(得分:0)
您应该将所有用户类型存储在单个用户表中,然后在角色表中创建不同的角色(用户,管理员,学生,学校等)。使用数据透视表分配用户和角色(user_roles)之间的关系。
一旦实现了这种关系,您就可以创建不同的中间件来检查角色并访问自动化。请参见详细的turorial here
https://www.5balloons.info/user-role-based-authentication-and-access-control-in-laravel/