Open with fade-zoom animation

Stay ahead...
Receive latest updates directly in your Inbox!

Auth Login with username Instead of Email

Laravel: Auth Login with username instead of email

Laravel provides a flexible authentication system out-of-box.

By default, the authentication system uses email for authentication. But it can be easily changed to any other fields like username or phone number.

To change the default authentication you will need to do the following:

  • In the login controller define a username function (Controller/Auth/LoginController.php)
  • Edit the login and registration views to change the email field to required authentication field.
  • Add the authentication field in the database, by editing create_users_table migration or creating a new migration.

That’s all you need to change and you’re ready.

Small Tip but helpfull.

No Comments

Leave a comment

Your email address will not be published. Required fields are marked *