where(['status' => 1])->orderBy('sort', 'desc'); }); } public function getGoodsTypesAttribute() { return self::query()->where(['parent_id' => $this->attributes['id']])->orderBy('sort', 'desc')->get()->toArray(); } public function getCoverUrlAttribute() { $url = $this->attributes['cover_img']; if(strripos($url,"http") === false){ return config('alioss.img_host').'/'.$url; }else{ return $url; } } }