0
我试图延长octobercms后端用户字段,但增加了新的后场不创建数据库列,如果我尝试保存表单有一个错误说,这个领域不存在数据库。那么如何为我的新领域添加一个列? 这里是我的代码:扩展字段OctoberCMS
public function boot()
{
// Extend all backend form usage
Event::listen('backend.form.extendFields', function($widget) {
// Only for the User controller
if (!$widget->getController() instanceof \Backend\Controllers\Users) {
return;
}
// Only for the User model
if (!$widget->model instanceof \Backend\Models\User) {
return;
}
// Add an extra birthday field
$widget->addTabFields([
'birthday' => [
'label' => 'Birthday',
'comment' => 'Select the users birthday',
'type' => 'datepicker',
'tab' => 'Billing'
]
]);
});
}
@Ahmed埃萨姆:我必须指出的是,直接添加到迁移别人的插件,你别管是自找麻烦。有关如何处理此问题的教程,请参阅https://vimeo.com/108040919。 – LukeTowers