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
?
vendor/laravel/framework/src/Illuminate/Foundation/Auth/AuthenticatesUsers.php
here you can findusername()
function just copy that and paste into your auth login controller as per laravel version it may b auth controller or login controller.public function username() { return 'email'; }
paste this code into it and change return value touser_email
. – Ritesh Khatri