[英]How to modify parameter on other table with the relation 1-N in Laravel-Backpack?
我必须在单击“保存”按钮时更新用户配置文件的图像。 要使用以下脚本添加图像:
$this->crud->addFields([
[
'name' => 'image',
'value' => 'uploads/germany.jpg', //Is an example
'label' => 'Image',
'type' => 'browse'
]
]);
问题是我的图像表被称为picture
其关系是1-N(1 [作者] - N [图片]),如何将我的图像放入Laravel-Backpack的表中?
表作者 [1]
protected $fillable = [
'id', //<-- PRIMARY KEY
'name',
'surname'
];
表图片 [N]
protected $fillable = [
"id",
"file",
"nome",
"tipo",
"mime",
"author_id" //<-- FOREIGN KEY
];
如果您有一个用户的多张图片(1-n关系),您可以使用upload_multiple字段类型并使用mutator将条目存储在该单独的表中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.