You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为October CMS的system_files表指定自定义attachment_type类字符串?

在October CMS中指定system_files表的attachment_type类字符串

默认配置下,attachOne关联会自动将当前模型的完整类名写入system_files表的attachment_type字段。如果需要自定义这个字段的类字符串,只需在关联配置中添加model参数,指定你想要的字符串即可:

public $attachOne = [
    'main_photo' => [
        'System\Models\File',
        'delete' => true,
        'model' => 'Your\Custom\ClassName' // 填写你指定的类字符串
    ]
];

添加model参数后,attachment_type字段就会存储你设置的自定义字符串,替代原本自动生成的模型类名。

内容的提问来源于stack exchange,提问作者Юрий Жулин

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.04 15:15:10