| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\common\model\system\auth;
- use app\common\model\BaseModel;
- class Role extends BaseModel
- {
- /**
- * @return string
- * @author zfy
- * @day 2020-03-30
- */
- public static function tablePk(): string
- {
- return 'role_id';
- }
- /**
- * @return string
- * @author zfy
- * @day 2020-03-30
- */
- public static function tableName(): string
- {
- return 'system_role';
- }
- public function ruleNames($isArray = false)
- {
- $menusName = Menu::getDB()->whereIn('menu_id', $this->rules)->column('menu_name');
- return $isArray ? $menusName : implode(',', $menusName);
- }
- /**
- * @param $value
- * @return array
- * @author zfy
- * @day 2020-03-30
- */
- public function getRulesAttr($value)
- {
- return array_map('intval', explode(',', $value));
- }
- /**
- * @param $value
- * @return string
- * @author zfy
- * @day 2020-03-30
- */
- public function setRulesAttr($value)
- {
- return implode(',', $value);
- }
- }
|