<?php
namespace app\common\model\sharing;
use app\common\model\BaseModel;
use app\common\model\Region as RegionModel;
class OrderAddress extends BaseModel
{
protected $name = 'sharing_order_address';
protected $updateTime = false;
protected $append = ['region'];
public function getRegionAttr($value, $data)
{
return [
'province' => RegionModel::getNameById($data['province_id']),
'city' => RegionModel::getNameById($data['city_id']),
'region' => $data['region_id'] == 0 ? '' : RegionModel::getNameById($data['region_id']),
];
}
public function getFullAddress()
{
return $this['region']['province'] . $this['region']['city'] . $this['region']['region'] . $this['detail'];
}
}