【发布时间】:2021-08-25 08:30:13
【问题描述】:
我正在尝试使用OcotberCMS 中的文件附件枢轴创建many-to-many 关系。
这是我的关系
public $belongsToMany = [
'users' => [
User::class,
'key' => 'task_id',
'otherKey' => 'user_id',
'table' => 'tasks_users',
'pivot' => ['status'],
'pivotModel' => TaskUser::class
]
];
在我的 pivotModel 中
class TaskUser extends Pivot
...
public $attachOne = [
'file' => ['System\Models\File']
];
YAML 配置
pivot:
form:
tabs:
fields:
pivot[file]:
label: Image
type: fileupload
mode: image
span: left
tab: Image
表单已正确呈现,但尝试上传文件时,抛出错误:
Upload error "A widget with class name 'relationUsersManagePivotFormPivotFile' has not been bound to the controller" on line 605 of D:\Projects\esport\modules\backend\classes\Controller.php
【问题讨论】:
标签: php model-view-controller yaml relationship octobercms