hasOne(Decostyle::class, 'id','decostyles_id')->bind(['decostyles_name'=> 'name']); } public function housetype(){ return $this->hasOne(BuildingHousetype::class, 'id','housetype_id'); } public function getCoverAttr($value){ if (empty($value)) return $value; $ali_oss_bindurl = config('app.ali_oss_bindurl'); $url = 'https://' . $ali_oss_bindurl . '/' . $value; return $url; } public function setCoverAttr($value){ $domain = config('app.ali_oss_bindurl'); $search = 'https://'.$domain.'/'; return str_replace($search, '', $value); } public function getImgContentAttr($value){ if (empty($value)) return $value; $ali_oss_bindurl = config('app.ali_oss_bindurl'); $url = 'https://' . $ali_oss_bindurl . '/'; $list=json_decode($value,true); foreach($list as $key=>$val){ $list[$key]['img']=$url.$val['img']; } return $list; } }