不包含 'file_src' 十月 CMS 的定义

Does not contain a definition for 'file_src' October CMS

我目前在 October CMS 插件开发工作,我遇到了文件上传问题。我把 fileupload 类型改为 file_src。当我转到资源时,它显示如下错误:

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

我该如何解决这个错误?

我修好了!我们必须在模型

上使用 $attachOne 或 $attachMany 关系

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

public $attachOne = [
    'file_src' => 'System\Models\File'
];

这就是它现在的工作!

Define the current module the selected control is a file. Mean your current selected control is as a file and you does not define in your module that time the backend has confused.

Solution:

public $attachOne = [
        'profile_pic' => \System\Models\File::class
    ];