【发布时间】:2018-12-30 02:15:53
【问题描述】:
我正在开发电子商务网站。我的产品上传很好,带有 1 张显示图像。我想在不同的表中单独上传多张图片,但通过 product_id 链接以识别属于该产品的图片
这是我的数据库架构
Schema::create('product_images', function (Blueprint $table) {
$table->increments('id');
$table->integer('product_id');
$table->string('name');
$table->string('size');
$table->timestamps();
$table->foreign('product_id')
->references('id')->on('products')
->onDelete('cascade');
});
有了这个我可以很好地上传图片,但是当我检查我的数据库时,没有外键链接到上传这些图片时捕获的产品
【问题讨论】:
标签: laravel