[英]Laravel Backpack - Upload multiple in PageTemplate
我正在尝试在页面编辑表单上上传多个图像。 在我的PageTemplates.php中,我有:
$this->crud->addField([
'name' => 'images',
'label' => 'Fotos',
'type' => 'upload_multiple',
'upload' => true,
'disk' => 'uploads',
'hint' => 'Some hint text.',
'fake' => true
]);
在我的Page模型中,我有:
public function setImagessAttribute($value)
{
$attribute_name = "images";
$disk = "uploads";
$destination_path = "images/pages";
$this->uploadMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
}
在config / filesystems.php的 $ disks数组中,我有:
'uploads' => [
'driver' => 'local',
'root' => public_path('uploads'),
],
但是当我尝试保存页面时,我遇到了两个问题:
在我的数据库extras字段中,我得到了:
"images":[
{
},
{
}
],
我究竟做错了什么?
执行以下操作后,它工作正常:
$fillable
'fake' => true
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.