AuthAssignment.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace common\models\rbac;
  3. use Yii;
  4. /**
  5. * This is the model class for table "{{%rbac_auth_assignment}}".
  6. *
  7. * @property int $role_id 角色
  8. * @property int $user_id 用户
  9. * @property string|null $app_id 应用入口
  10. */
  11. class AuthAssignment extends \yii\db\ActiveRecord
  12. {
  13. /**
  14. * {@inheritdoc}
  15. */
  16. public static function tableName()
  17. {
  18. return '{{%rbac_auth_assignment}}';
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function rules()
  24. {
  25. return [
  26. [['role_id', 'user_id'], 'required'],
  27. [['role_id', 'user_id'], 'integer'],
  28. [['app_id'], 'string', 'max' => 20],
  29. ];
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function attributeLabels()
  35. {
  36. return [
  37. 'role_id' => '角色',
  38. 'user_id' => '用户',
  39. 'app_id' => '应用入口',
  40. ];
  41. }
  42. /**
  43. * @return \yii\db\ActiveQuery
  44. */
  45. public function getRole()
  46. {
  47. return $this->hasOne(AuthRole::class, ['id' => 'role_id']);
  48. }
  49. }
粤ICP备19079148号