SaasCategory.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\behaviors\TimestampBehavior;
  10. use yii\db\ActiveRecord;
  11. /**
  12. * This is the model class for table "{{%saas_category}}".
  13. *
  14. * @property integer $id
  15. * @property string $name
  16. * @property integer $is_enable
  17. * @property integer $is_delete
  18. * @property string $option
  19. * @property integer $sort
  20. * @property integer $created_at
  21. * @property integer $updated_at
  22. * @property string $icon
  23. */
  24. class SaasCategory extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * 删除状态:已删除
  28. */
  29. const DELETE_STATUS_TRUE = 1;
  30. /**
  31. * 删除状态:未删除
  32. */
  33. const DELETE_STATUS_FALSE = 0;
  34. /**
  35. * 禁用状态:已禁用
  36. */
  37. const IS_ENABLE_FALSE = 0;
  38. /**
  39. * 禁用状态:未禁用
  40. */
  41. const IS_ENABLE_TRUE= 1;
  42. /**
  43. * @inheritdoc
  44. */
  45. public static function tableName()
  46. {
  47. return '{{%saas_category}}';
  48. }
  49. /**
  50. * @inheritdoc
  51. */
  52. public function rules()
  53. {
  54. return [
  55. [['is_delete', 'is_enable', 'sort'], 'integer'],
  56. [['name', 'icon'], 'string', 'max' => 255],
  57. [['option'], 'string'],
  58. ];
  59. }
  60. public function behaviors()
  61. {
  62. return [
  63. [
  64. 'class' => TimestampBehavior::class,
  65. 'attributes' => [
  66. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  67. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  68. ]
  69. ]
  70. ];
  71. }
  72. /**
  73. * @inheritdoc
  74. */
  75. public function attributeLabels()
  76. {
  77. return [
  78. 'id' => '分类ID',
  79. 'name' => '分类名称',
  80. 'is_delete' => 'Is Delete',
  81. 'is_enable' => '状态',
  82. 'created_at' => '创建时间',
  83. 'updated_at' => '更新时间',
  84. 'option' => '筛选配置',
  85. 'sort' => '排序',
  86. 'icon' => '图标',
  87. ];
  88. }
  89. }