Home > Back-end >  Two different login system in Laravel 9
Two different login system in Laravel 9

Time:07-04

In my case, I will create a login system with two different users. a) Voters and b) Administrators. Where "Voters" login using the ID Number and password. That password generated by the Administrator (ID Number is taken from the "voters" table), and the Administrator logs in using the username and password. I'm confused how to make it. Please tell me what I should do first. Thanks

CodePudding user response:

I would suggest to use the users table in your database and add a "role" colnum. You can then disable the registration of new users after creating an admin user.

Another option is to use the users table for administrators only and create some kind of login form for voters where you set their logged in status in the session assigned to the user from laravel and go from there onwards.

CodePudding user response:

You need a multi guard authentication. Read this how to. It works with two tables. https://codecheef.org/article/laravel-9-multiple-authentication-example-using-guard

  • Related