FoodCat.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\behaviors\TimestampBehavior;
  9. use yii\db\ActiveRecord;
  10. /**
  11. * 点餐分类
  12. * Class FoodCat
  13. * @package app\models
  14. * @property integer $id
  15. * @property integer $store_id
  16. * @property string $name
  17. * @property string $desc
  18. * @property string $pic_url
  19. * @property integer $sort
  20. * @property integer $is_delete
  21. * @property string $is_show
  22. * @property string $created_at
  23. * @property string $updated_at
  24. * @property integer $md_id
  25. */
  26. class FoodCat extends ActiveRecord
  27. {
  28. public function behaviors()
  29. {
  30. return [
  31. [
  32. // 自动更新创建和更新时间
  33. 'class' => TimestampBehavior::class,
  34. 'value' => time()
  35. ]
  36. ];
  37. }
  38. public static function tableName()
  39. {
  40. return '{{%food_cat}}';
  41. }
  42. public function rules()
  43. {
  44. return [
  45. [['store_id', 'name',], 'required'],
  46. [['store_id', 'sort', 'created_at', 'updated_at', 'is_delete', 'is_show', 'md_id'], 'integer'],
  47. [['pic_url'], 'string'],
  48. [['name', 'desc'], 'string', 'max' => 255],
  49. ];
  50. }
  51. public function attributeLabels()
  52. {
  53. return [
  54. 'id' => 'ID',
  55. 'store_id' => '商城id',
  56. 'name' => '分类名称',
  57. 'desc' => '描述',
  58. 'pic_url' => '分类图片url',
  59. 'sort' => '排序,升序',
  60. 'created_at' => '创建时间',
  61. 'updated_at' => '更新时间',
  62. 'is_delete' => 'Is Delete',
  63. 'is_show' => '是否显示',
  64. ];
  65. }
  66. }