mercredi 31 mai 2017

Laravel Authentication using multiple Tables

I am new to Laravel. My application has below tables description

Users

+-----------------+------------------+------+-----+---------+----------------+
| Field           | Type             | Null | Key | Default | Extra          |
+-----------------+------------------+------+-----+---------+----------------+
| id              | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| email           | varchar(100)     | NO   | UNI | NULL    |                |
| first_name      | varchar(100)     | NO   |     | NULL    |                |
| last_name       | varchar(100)     | YES  |     | NULL    |                |
| profile_pic     | text             | YES  |     | NULL    |                |
| about           | text             | YES  |     | NULL    |                |
| alternate_email | varchar(200)     | YES  |     | NULL    |                |
| username        | varchar(70)      | NO   | UNI | NULL    |                |
| suspended       | tinyint(4)       | NO   |     | 0       |                |
| verified        | tinyint(4)       | NO   |     | 0       |                |
| remember_token  | varchar(100)     | YES  |     | NULL    |                |
| created_at      | int(11)          | NO   |     | NULL    |                |
| updated_at      | int(11)          | YES  |     | NULL    |                |
| deleted_at      | int(11)          | YES  |     | NULL    |                |
+-----------------+------------------+------+-----+---------+----------------+

The other table is UsersLogin:

+-----------------------+------------------+------+-----+---------+----------------+
| Field                 | Type             | Null | Key | Default | Extra          |
+-----------------------+------------------+------+-----+---------+----------------+
| id                    | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| user_id               | int(10) unsigned | NO   | MUL | NULL    |                |
| password              | text             | NO   |     | NULL    |                |
| password_salt         | text             | NO   |     | NULL    |                |
| password_salt_expiry  | int(11)          | NO   |     | NULL    |                |
| last_login            | int(11)          | NO   |     | NULL    |                |
| forgot_pass_key       | text             | YES  |     | NULL    |                |
| forgot_pass_expiry    | int(11)          | YES  |     | NULL    |                |
| forgot_pass_link_at   | int(11)          | YES  |     | NULL    |                |
| password_reset_at     | int(11)          | YES  |     | NULL    |                |
| signup_auth_key       | text             | YES  |     | NULL    |                |
| signup_auth_expiry    | int(11)          | YES  |     | NULL    |                |
| signup_verified_at    | int(11)          | YES  |     | NULL    |                |
| signup_verify_link_at | int(11)          | YES  |     | NULL    |                |
| created_at            | int(11)          | NO   |     | NULL    |                |
| updated_at            | int(11)          | YES  |     | NULL    |                |
+-----------------------+------------------+------+-----+---------+----------------+

Now as you can see, I have username and passwords in two differnet tables. I need to create a login with this table structure.

How should I implement my Auth facade to achieve this?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire