QAndAQuestionTemplate.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use yii\db\ActiveRecord;
  9. use yii\behaviors\TimestampBehavior;
  10. /**
  11. * This is the model class for table "{{%q_and_a_question_template}}".
  12. *
  13. * @property int $id
  14. * @property int $store_id
  15. * @property int $is_delete
  16. * @property int $cat_id
  17. * @property string $name
  18. * @property string $question
  19. * @property int $created_at
  20. * @property int $is_hot
  21. * @property int $updated_at
  22. * @property int $state
  23. */
  24. class QAndAQuestionTemplate extends \yii\db\ActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%q_and_a_question_template}}';
  32. }
  33. public function behaviors()
  34. {
  35. return [
  36. [
  37. 'class' => TimestampBehavior::class,
  38. 'attributes' => [
  39. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  40. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  41. ]
  42. ]
  43. ];
  44. }
  45. /**
  46. * {@inheritdoc}
  47. */
  48. public function rules()
  49. {
  50. return [
  51. [['store_id', 'name', 'question', 'is_hot', 'cat_id'], 'required'],
  52. [['store_id', 'name', 'question', 'created_at', 'is_delete', 'updated_at', 'state'], 'safe']
  53. ];
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function attributeLabels()
  59. {
  60. return [
  61. 'id' => 'ID',
  62. 'store_id' => 'Store ID',
  63. 'cat_id' => '分类id',
  64. 'name' => '名称',
  65. 'question' => '问题',
  66. 'is_hot' => '是否热门',
  67. 'created_at' => '添加时间',
  68. 'is_delete' => '是否删除',
  69. 'updated_at' => 'Update Time',
  70. ];
  71. }
  72. }