我创建了laravelbackpack fbtracking项目。当我添加数据库迁移数据时,出现错误为“ LaravelBackpack 5.5:MassAssignmentException将[date_times]添加到fillable属性,以允许在[App \ Models \ Fbpage]上进行批量分配。”
这是我的Laravel代码 01-数据库表迁移
enter code here
public function up()
{
Schema::create('fbpages', function (Blueprint $table) {
$table->increments('id');
$table->date('date_times');
$table->string('fb_names');
$table->double('fb_likes');
$table->timestamps();
});
}
02-模型“ Fbpage”
enter code here
Fbpage类扩展模型 { 使用CrudTrait;
protected $table = 'fbpages';
// protected $primaryKey = 'id';
public $timestamps = false;
// protected $guarded = ['id'];
protected $fillable = [];
// protected $hidden = [];
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'date_times'];}