You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Address.php 836 B

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace addons\unishop\model;
  3. use think\Model;
  4. /**
  5. * 收货地址模型
  6. * Class Favorite
  7. * @package addons\unishop\model
  8. */
  9. class Address extends Model
  10. {
  11. // 表名
  12. protected $name = 'unishop_address';
  13. // 开启自动写入时间戳字段
  14. protected $autoWriteTimestamp = 'int';
  15. // 定义时间戳字段名
  16. protected $createTime = 'createtime';
  17. protected $updateTime = 'updatetime';
  18. // 是否为默认地址?
  19. const IS_DEFAULT_YES = 1; //是
  20. const IS_DEFAULT_NO = 0; //否
  21. public function province()
  22. {
  23. return $this->belongsTo('area', 'province_id', 'id');
  24. }
  25. public function city()
  26. {
  27. return $this->belongsTo('area', 'city_id', 'id');
  28. }
  29. public function area()
  30. {
  31. return $this->belongsTo('area', 'area_id', 'id');
  32. }
  33. }