Laravel: Login and Password in different tables

63 views Asked by At

I'am a new in Laravel, but not in php and sql.

So I have Users and Users_password tables.

The User table looks like:

  user_rec_id |  FirstName    | sName  | created_at   |
-----------------------------------------------------------------
       1      |      Smith    |  Ala   |     date     |
       2      |      Smith    |  Doe   |     date     |
       3      |      Marks    |  Ill   |     date     |
  • user_rec_id - is a record id in TABLE

The Users_password table looks like:

  pwd_rec_id | pwd_user_rec_id   | pwd_sHash   | created_at   |
-----------------------------------------------------------
    1        |      1            |     #112    |     date     |
    2        |      2            |     $559    |     date     |
    3        |      1            |     !555    |     date     |
  • pwd_rec_id - is a record id in TABLE

  • pwd_user_rec_id - is a primary key in User table.

Logging data must be newest. I mean sign in with Login 'Smith Ala' and password '#112' (user id: 1) will be failed. Beacause actual Login and password for user_id 1 is 'Smith Doe' + '!555'

So, how I can make a currect model for User and UserPassword?

After slove my probem, I'd like that creating new user must be like User->create or something like that. And working Auth::attempt() by FirstName, sName [in User table] and pwd_sHash [in Users_password]

0

There are 0 answers