Login with email or phone number in Laravel
How to Login with email or phone number in Laravel
In this post, you will be learning how to login with email id or phone/mobile number or username in laravel.
Let's get started.
Step 1: Install your laravel application and get your database connected and migrate the tables.
Step 2: Create a migration file as follows
After successful of creating migration, paste the below code in your last migration file. (2022_10_30_102257_add_phone_to_users_table.php)
Step 3: Go to the login.blade.php file in following path: resources/views/auth/login.blade.php
In this file, change the <input type="email" /> to <input type="text" /> for the email input field as follows:
Step 4: Go to LoginController.php in the following path: app/http/controllers/auth/LoginController.php
Paste the below code in your LoginController.php file
That's it, now you can login with your email id or phone number in laravel.
Thanks for reading.