Modify existing Authorization module (email to username)

Laravel search the variable $username in the file :

Illuminate\Foundation\Auth\AuthenticatesUsers

public function loginUsername() {
    return property_exists($this, 'username') ? $this->username : 'email';
}

As you can see, by default it will be named as ’email’.

However you can override it in your AuthController by adding :

protected $username="username";

Leave a Comment