Ale*_*ban 0 custom-authentication laravel laravel-authentication
当我email从数据库字段更改为Laravel错误user_email
Illuminate \ Database \ QueryException SQLSTATE [42S22]:找不到列:1054“ where子句”中的未知列“ email”(SQL:select * from
ns_userswhere
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();
});
Run Code Online (Sandbox Code Playgroud)
有人知道我必须更改默认身份验证才能使用user_email字段而不是email吗?
缺省情况下,Laravel使用该email字段进行身份验证。如果您想对此进行自定义,则可以username在上定义一个方法LoginController:
public function username()
{
return 'user_email';
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
397 次 |
| 最近记录: |