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.
Latest PostsLogin with email or phone number in Laravel How to get/find data by multiple ids in laravel How to create or generate slug in laravel 8 How to show session flash message in laravel 8 How to show success message in laravel 8 Laravel 8 set custom messages in form request validation Laravel 8 Form Request Validation How to Create Pagination in Laravel 8 How to upload image in laravel 8 How to get data from database by id in laravel 8
© Copyright - 2018 - 2022 | All rights reserved at Funda of Web IT