FoodCat.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\plugins\food\models;
  8. use yii\behaviors\TimestampBehavior;
  9. use yii\db\ActiveRecord;
  10. /**
  11. * 点餐分类
  12. * Class FoodCat
  13. * @package app\plugins\food\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. */
  25. class FoodCat extends ActiveRecord
  26. {
  27. public function behaviors()
  28. {
  29. return [
  30. [
  31. // 自动更新创建和更新时间
  32. 'class' => TimestampBehavior::class,
  33. 'value' => time()
  34. ]
  35. ];
  36. }
  37. public static function tableName()
  38. {
  39. return '{{%food_cat}}';
  40. }
  41. public function rules()
  42. {
  43. return [
  44. [['store_id', 'name',], 'required'],
  45. [['store_id', 'sort', 'created_at', 'updated_at', 'is_delete', 'is_show'], 'integer'],
  46. [['pic_url'], 'string'],
  47. [['name', 'desc'], 'string', 'max' => 255],
  48. ];
  49. }
  50. public function attributeLabels()
  51. {
  52. return [
  53. 'id' => 'ID',
  54. 'store_id' => '商城id',
  55. 'name' => '分类名称',
  56. 'desc' => '描述',
  57. 'pic_url' => '分类图片url',
  58. 'sort' => '排序,升序',
  59. 'created_at' => '创建时间',
  60. 'updated_at' => '更新时间',
  61. 'is_delete' => 'Is Delete',
  62. 'is_show' => '是否显示',
  63. ];
  64. }
  65. }