十月cms用户插件多对多关系

时间:2017-12-04 14:17:32

标签: many-to-many octobercms octobercms-user-plugin

具有以下表格结构

user
| id | name |

class
| id | name |

users_classes
   | user_id | class_id | value |

我与belongsToMany建立了多对多的关系 User.php

public $belongsToMany = [
        'groups' => [UserGroup::class, 'table' => 'users_groups'],
        'classes' => [UserClass::class,
            'table' => 'users_classes',
            'key'=>'user_id',
            ],
    ];

UserClass.php

public $belongsToMany = [
        'users' => [User::class,
            'table' => 'users_classes',
            'key'=>'class_id']
    ];

还有rainlab \ user \ models \ user \ fields.yaml

类: 标签:类 类型:关系

我可以在users_classes中添加user_id和class_id 但我无法在后端形式中看到VALUE字段? 如何将users_classes.value字段添加到管理表单并在其中添加一些值?

0 个答案:

没有答案