Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

laravel 自定义用户表的问题

  1. 创建迁移

    public function up()
    {
     Schema::create('users', function (Blueprint $table) {
         $table->increments('id');
         $table->string('account');
         $table->string('password');
         $table->char('phone',11)->unique();
         $table->string('email')->unique();
         $table->timestamp('email_verified_at')->nullable();
         $table->tinyInteger('user_status')->default(1);
         $table->tinyInteger('user_type')->default(1);
         $table->rememberToken();
         $table->timestamps();
     });
    }
  2. 填充数据

    User::factory()->create([
     'account'=>'xbvan',
     'password'=>Hash::make('123456'),
     'phone'=>'13800168222',
     'email'=>'xbvan@163.com'
    ]);
  3. 报错
    报错信息

为什么会报没有字段 name 这个问题,定义的 users 表并没有 name 字段

Enregistrer un commentaire

0 Commentaires