AuthItemChild.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace common\models\rbac;
  3. use common\enums\StatusEnum;
  4. use Yii;
  5. /**
  6. * This is the model class for table "{{%rbac_auth_item_child}}".
  7. *
  8. * @property int $role_id 角色id
  9. * @property int $item_id 权限id
  10. * @property string $name 别名
  11. * @property string $app_id 类别
  12. * @property int|null $is_addon 是否插件
  13. * @property string|null $addon_name 插件名称
  14. */
  15. class AuthItemChild extends \common\models\base\BaseModel
  16. {
  17. /**
  18. * {@inheritdoc}
  19. */
  20. public static function tableName()
  21. {
  22. return '{{%rbac_auth_item_child}}';
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function rules()
  28. {
  29. return [
  30. [['role_id', 'item_id', 'is_addon'], 'integer'],
  31. [['name'], 'string', 'max' => 64],
  32. [['app_id'], 'string', 'max' => 20],
  33. [['addon_name'], 'string', 'max' => 200],
  34. ];
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function attributeLabels()
  40. {
  41. return [
  42. 'role_id' => '角色id',
  43. 'item_id' => '权限id',
  44. 'name' => '别名',
  45. 'app_id' => '类别',
  46. 'is_addon' => '是否插件',
  47. 'addon_name' => '插件名称',
  48. ];
  49. }
  50. /**
  51. * @return \yii\db\ActiveQuery
  52. */
  53. public function getItem()
  54. {
  55. return $this->hasOne(AuthItem::class, ['name' => 'name'])
  56. ->orderBy('sort asc, id asc')
  57. ->where(['status' => StatusEnum::ENABLED]);
  58. }
  59. }
粤ICP备19079148号