| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace app\common\model\supplier;
- use app\common\model\BaseModel;
- /**
- * 应用模型
- */
- class Role extends BaseModel
- {
- protected $name = 'supplier_role';
- protected $pk = 'role_id';
- /**
- * 关联权限
- * @return \think\model\relation\HasMany
- */
- public function access()
- {
- return $this->hasMany('RoleAccess', 'role_id', 'role_id');
- }
- /**
- * 获取详情
- */
- public static function detail($role_id)
- {
- return (new static())->with(['access'])->find($role_id);
- }
- }
|