|
@@ -23,7 +23,11 @@ class Address extends Model
|
|
|
protected $deleteTime = 'deletetime';
|
|
|
|
|
|
// 追加属性
|
|
|
- protected $append = [];
|
|
|
+ protected $append = [
|
|
|
+ 'city',
|
|
|
+ 'area',
|
|
|
+ 'province',
|
|
|
+ ];
|
|
|
|
|
|
public static function init()
|
|
|
{
|
|
@@ -40,6 +44,21 @@ class Address extends Model
|
|
|
//$row['address'] = $row->address_full;
|
|
|
});
|
|
|
}
|
|
|
+ public function getCityAttr($value, $data)
|
|
|
+ {
|
|
|
+ $areainfo = $this->getAreainfoAttr($value, $data);
|
|
|
+ return $areainfo['city'] ? $areainfo['city']['name'] : '';
|
|
|
+ }
|
|
|
+ public function getAreaAttr($value, $data)
|
|
|
+ {
|
|
|
+ $areainfo = $this->getAreainfoAttr($value, $data);
|
|
|
+ return $areainfo['area'] ? $areainfo['area']['name'] : '';
|
|
|
+ }
|
|
|
+ public function getProvinceAttr($value, $data)
|
|
|
+ {
|
|
|
+ $areainfo = $this->getAreainfoAttr($value, $data);
|
|
|
+ return $areainfo['province'] ? $areainfo['province']['name'] : '';
|
|
|
+ }
|
|
|
|
|
|
public function getAddressBaseAttr($value, $data)
|
|
|
{
|