you are doing it wrong! your db structure should be:
users(id, username, password, member_type) where member_type can change to be admin or user..
shez1983 said:
you are doing it wrong! your db structure should be:
users(id, username, password, member_type) where member_type can change to be admin or user..
yes, I understand :)
but if using 2 different tables for auth, is it possible?
It's possible, but it wouldn't be "easy" for a "newbie". There are also some concerns and some questions that come to mind, such as what happens when you have the same username in both tables? the same username and same password? are you going to use two different login forms?
At best, I imagine using one table per "role", within Laravel, means much more work for no extra benefit.
If possible, you should strongly consider using shez1983's suggestion. As it's likely the easiest way.
There's another method, which I prefer, where you have three tables. users, roles, and user_role. The 3rd is a pivot table used to relate users and roles. Users belongToMany Roles and Roles belongToMany Users. However, this might be overkill for your assignment.
manojibcarockers liked this reply
textbookcharlie said:
It's possible, but it wouldn't be "easy" for a "newbie". There are also some concerns and some questions that come to mind, such as what happens when you have the same username in both tables? the same username and same password? are you going to use two different login forms?
At best, I imagine using one table per "role", within Laravel, means much more work for no extra benefit.
If possible, you should strongly consider using shez1983's suggestion. As it's likely the easiest way.
There's another method, which I prefer, where you have three tables. users, roles, and user_role. The 3rd is a pivot table used to relate users and roles. Users belongToMany Roles and Roles belongToMany Users. However, this might be overkill for your assignment.
thank you for the explanation.
I think this is not will be easy, especially because I'm a newbie in laravel..
but thank you for the solution :)
Same problem.
When admin login and member login use same code
Auth::user();
I has been set auth in fillters.php
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community