$v,'vr_img'=>getFirstImg($v)]; } return $new; } public function setCoverImgAttr($value) { if (empty($value)) return $value; $domain = config('app.ali_oss_bindurl'); $item = 'https://' . $domain . '/'; $value = str_replace($item,'',$value); return $value; } public function setDescAttr($value) { if (empty($value)) return $value; $domain = config('app.ali_oss_bindurl'); $item = 'https://' . $domain . '/'; $list = explode(',',$value); $str = null; foreach($list as $v){ $str.= str_replace($item,'',$v).','; } return trim($str,','); } public function decostyle() { return $this->hasOne(Decostyle::class, 'id','style_id')->bind(['style_name'=>'name']); } public function housetype() { return $this->hasOne(Housetype::class, 'id','housetype_id')->bind(['housetype_name'=>'name']); } }