Does not contain a definition for 'file_src' October CMS

Ans*_*Ans 1 octobercms-plugins

I am currently working at October CMS plugin development, I have a problem with file upload. I put the fileupload type to file_src. When I go to to resource it shows an error like this :

在此处输入图片说明

model/resource
    fields:
        name:
            label: Name
            type: text
            required: true
        file_src:
            label: Upload
            type: fileupload
        grade_id:
            label: Grade
            type: dropdown
            emptyOption: Select
            showSearch: true
        subject_id:
            label: Subject
            type: dropdown
            emptyOption: Select
            showSearch: true
        type_id:
            label: Type
            type: dropdown
            emptyOption: Select
            showSearch: true
Run Code Online (Sandbox Code Playgroud)

How can I fix this error?

Ans*_*Ans 5

我修好了它!我们必须在模型上使用 $attachOne 或 $attachMany 关系

我在 Resource.php 中的模型中添加了以下代码

public $attachOne = [
    'file_src' => 'System\Models\File'
];
Run Code Online (Sandbox Code Playgroud)

这就是它现在的工作!