Laravel error when I change the email
field from database to user_email
Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'email' in 'where clause' (SQL: select * from
ns_users
where
Schema::create('ns_users', function (Blueprint $table) {
$table->increments('user_id');
$table->boolean('active')->default(0);/*by default the user is not active*/
$table->integer('role')->default(0);/* role 0 means user and role 1 means admin!! */
$table->string('name');
$table->string('user_email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Does anybody know what I have to change in default auth to work with user_email
field instead of email
?
By default, Laravel uses the email
field for authentication. If you would like to customize this, you may define a username
method on your LoginController
:
public function username()
{
return 'user_email';
}