Faker 没有正确播种数据库
Faker not seeding db properly
我正在尝试用 faker 为我的数据库播种。除图像外,所有内容均已正确填写。它们存在于我的存储文件夹中,但在数据库中写入为 0。我很困惑,我已经查看了此处提供的 questions/answers,但我还没有找到解决方案。
任何帮助将不胜感激。
型号:
protected $fillable = [
'title','description','image','price','category_id','user_id'
];
工厂:
'image' => $faker->image(storage_path('app/public/products'), 800, 800, null, false),
迁移:
$table->string('image')->nullable();;
试试这个 'image' => $faker->image(storage_path('app/public/products'), 800, 800, '', false)
我正在尝试用 faker 为我的数据库播种。除图像外,所有内容均已正确填写。它们存在于我的存储文件夹中,但在数据库中写入为 0。我很困惑,我已经查看了此处提供的 questions/answers,但我还没有找到解决方案。 任何帮助将不胜感激。
型号:
protected $fillable = [
'title','description','image','price','category_id','user_id'
];
工厂:
'image' => $faker->image(storage_path('app/public/products'), 800, 800, null, false),
迁移:
$table->string('image')->nullable();;
试试这个 'image' => $faker->image(storage_path('app/public/products'), 800, 800, '', false)