How to use Username(Unique Name) for logging in instead of email in Laravel

In this article We’ll talk about how to use username(Unique Name) for logging in instead of email.

First you can find AuthenticatesUsers.php file using following file Direction in your Laravel Project.

File Path : vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php

Find Following Function.

public function username()
        return 'email';

The above function Change email to username (User table Defined Field).

don’t forget to change email as username in login.blade.php

You May Also Like

Leave a Reply

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