Form.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /**
  10. * This is the model class for table "{{%form}}".
  11. *
  12. * @property integer $id
  13. * @property integer $store_id
  14. * @property integer $goods_id
  15. * @property string $name
  16. * @property string $type
  17. * @property integer $required
  18. * @property string $default
  19. * @property string $tip
  20. * @property integer $sort
  21. * @property integer $is_delete
  22. * @property integer $created_at
  23. */
  24. class Form extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * @inheritdoc
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%form}}';
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['store_id', 'required', 'sort', 'is_delete', 'created_at', 'goods_id'], 'integer'],
  40. [['name', 'type', 'default', 'tip'], 'string', 'max' => 255],
  41. ];
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => 'ID',
  50. 'store_id' => 'Store ID',
  51. 'name' => '名称',
  52. 'type' => '类型',
  53. 'required' => '必填项',
  54. 'default' => '默认值',
  55. 'tip' => '提示语',
  56. 'sort' => '排序',
  57. 'is_delete' => 'Is Delete',
  58. 'created_at' => 'Addtime',
  59. ];
  60. }
  61. public function beforeSave($insert)
  62. {
  63. $this->name = \yii\helpers\Html::encode($this->name);
  64. $this->tip = \yii\helpers\Html::encode($this->tip);
  65. $this->default = \yii\helpers\Html::encode($this->default);
  66. return parent::beforeSave($insert);
  67. }
  68. }