[Quick tip] Custom Table User in Authentication on laravel

Default when make feather Authentication is table User, and fields: 

> name, email, password,...


A. When you want to custom table name, or field name?? 

Ex: 

> table members, and fields: user_name, user_email, user_pass

1. Update table name on config/auth

2. At User modal: add or update:

2b. Also, at LoginController, add:

3. Update view blade file -> field form Login/Register:

Update attribute name, such as

4. Update field name on validator, create method of RegisterController

5. Update table members that have field: remember_token, email_verified_at


B. When add mew field:

Do step 2,3,4 above same as any field.


Ref:

https://stackoverflow.com/questions/55626323/changing-laravel-auth-table-name-and-column-names

https://laracasts.com/discuss/channels/laravel/change-column-names-for-the-auth

https://viblo.asia/p/tao-authentication-rieng-de-check-dang-nhap-trong-laravel-63vKj0WVl2R

Nhận xét