Home > OS >  modify the default login in laravel
modify the default login in laravel

Time:03-11

i need to modify the default login, (email and password). I must use a field other than email to make the login

User Model:

  protected $fillable = [
    'name',
    'email',
    't_matricula',
    'matricula',
    'number',
    'password',
];

i could use the Number field as data to login, where should I modify to use Number instead of Name?

CodePudding user response:

let's say that the field you want to use is number instead of email all you have to do is to go to the LoginController in the following path app/Http/Controllers/Auth/LoginController.php and add the following method:

public function username()
{
    return 'number';
}

by the way the field must be a string.

  • Related