我正在运行 Laravel 5.2,在 Windows 8.1 上使用 XAMPP 和 php 7.2,我正在尝试使用带有 sqlite 数据库的 laravel auth 注册表来注册用户。但是,当我尝试将新记录插入表时users,出现错误。
SQLSTATE[HY000]:一般错误:1 没有这样的表:用户
当我迁移数据库时,它会创建用户表。但是当我尝试users使用注册表在表中插入新记录时,它会尝试访问user表。所以我user在数据库中创建了表,它工作正常,但记录插入到users表中而不是user表中。
移民
public function up(){
Schema::create('users', function (Blueprint $table) {
$table->increments('user_id');
$table->string('name');
$table->string('role');
$table->string('username');
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
public function down(){
Schema::drop('users');
}
Run Code Online (Sandbox Code Playgroud)
用户模型
class User extends Authenticatable{
protected $primaryKey = 'user_id';
protected $fillable = [
'name', 'role', 'username', 'password',
];
protected $hidden = [
'password', 'remember_token',
];
}
Run Code Online (Sandbox Code Playgroud)
身份验证控制器 …