Warehouse.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * This is the model class for table "{{%warehouse}}".
  12. *
  13. * @property integer $id
  14. * @property integer $store_id
  15. * @property string $name
  16. * @property integer $sort
  17. * @property integer $is_delete
  18. */
  19. class Warehouse extends \yii\db\ActiveRecord
  20. {
  21. /**
  22. * @inheritdoc
  23. */
  24. public static function tableName()
  25. {
  26. return '{{%warehouse}}';
  27. }
  28. public function rules()
  29. {
  30. return [
  31. [['id', 'sort', 'is_delete', 'store_id'], 'integer'],
  32. [['name'], 'string'],
  33. [['created_at', 'updated_at'], 'safe']
  34. ];
  35. }
  36. public function behaviors()
  37. {
  38. return [
  39. [
  40. 'class' => TimestampBehavior::class,
  41. 'attributes' => [
  42. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  43. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  44. ]
  45. ]
  46. ];
  47. }
  48. }