QAndACat.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_cat}}".
  12. *
  13. * @property int $id
  14. * @property int $store_id
  15. * @property int $is_delete
  16. * @property string $name
  17. * @property int $created_at
  18. * @property int $updated_at
  19. * @property int $sort
  20. * @property int $state
  21. */
  22. class QAndACat extends \yii\db\ActiveRecord
  23. {
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public static function tableName()
  28. {
  29. return '{{%q_and_a_cat}}';
  30. }
  31. public function behaviors()
  32. {
  33. return [
  34. [
  35. 'class' => TimestampBehavior::class,
  36. 'attributes' => [
  37. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  38. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  39. ]
  40. ]
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['name', 'store_id', 'sort', 'state'], 'required'],
  50. [['store_id', 'name', 'created_at', 'is_delete', 'updated_at'], 'safe']
  51. ];
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'id' => 'ID',
  60. 'store_id' => 'Store ID',
  61. 'name' => '名称',
  62. 'created_at' => '添加时间',
  63. 'is_delete' => '是否删除',
  64. 'updated_at' => 'Update Time',
  65. ];
  66. }
  67. }