'正常', self::STATUS_PAUSE => '暂停', ]; // 区域中心位置(redis) const REDIS_AREAS_LOCATION_TAG = 'areas_locations'; const REDIS_AREAS_TAG = 'areas'; protected $fillable = ['name', 'admin_id', 'area_fence', 'area_fushe_fence','area_centre', 'area_radius', 'customer_service_time', 'customer_service_phone', 'status','merchant_id']; // public function getCustomerServiceTimeAttribute($value){ // $arr = json_decode($value); // $str = date('H:i:s',strtotime($arr[0])).'--'.date('H:i:s',strtotime($arr[1])); // return $str; // } public function getAreaCentreAttribute($value) { return toGaodeCentreData($value); } public function getWxAreaCentreAttribute() { return $this->attributes['area_centre']; } public function getAreaFenceAttribute($value) { return toGaodeFenceData($value); } public function getAreaFusheFenceAttribute($value) { return toGaodeFenceData($value); } public function getWxAreaFenceAttribute() { return $this->attributes['area_fence']; } public function setAreaCentreAttribute($value) { $this->attributes['area_centre'] = latToLatitude($value); } public function setAreaFenceAttribute($value) { $this->attributes['area_fence'] = latToLatitude($value); } public function setAreaFusheFenceAttribute($value) { $this->attributes['area_fushe_fence'] = latToLatitude($value); } public function parking() { return $this->hasMany(Parking::class, 'area_id', 'id'); } public function areaSetting() { return $this->hasOne(AreaSetting::class, 'area_id', 'id'); } // 关联商户表 public function merchantData() { return $this->hasOne(AdminMerchant::class, 'id', 'merchant_id'); } public function adminUser() { return $this->belongsToMany(AdminUser::class, 'admin_area', 'admin_id', 'area_id'); } // protected static function boot() // { // parent::boot(); // // static::deleting(function ($area) { // $area->parking()->delete(); // $area->areaSetting()->delete(); // }); // } }