You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Como hacer login en Laravel con username en lugar de por email utilizando la autenticación por defecto
Como hacer login con username en lugar de por email
El controlador App\Http\Controllers\Auth\LoginController implementa el trait AuthenticatesUsers y este es el encargado de realizar la validación del Login. El método validateLogin() valida el campo email por defecto pero este lo obtiene del método username() que retorna el campo email por eso si lo que queremos es validar el login por otro campo (En este ejemplo será el campo 'username') debemos:
1- En la migracion de la tabla users (2014_10_12_000000_create_users_table.php) agregar el campo username es importante que este sea de tipo unique
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('username')->unique();
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Laravel command for production database replication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters