UserAddress.php 742 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace app\common\model\user;
  3. use app\common\model\BaseModel;
  4. use app\common\repositories\store\CityAreaRepository;
  5. class UserAddress extends BaseModel
  6. {
  7. /**
  8. * @return string
  9. * @author zfy
  10. * @day 2020-03-30
  11. */
  12. public static function tablePk(): string
  13. {
  14. return 'address_id';
  15. }
  16. /**
  17. * @return string
  18. * @author zfy
  19. * @day 2020-03-30
  20. */
  21. public static function tableName(): string
  22. {
  23. return 'user_address';
  24. }
  25. public function getAreaAttr()
  26. {
  27. return app()->make(CityAreaRepository::class)->search([])->whereIn('id', [$this->province_id, $this->city_id, $this->district_id, $this->street_id])->order('id ASC')->select();
  28. }
  29. }