where(['status' => 1])->orderBy('sort', 'desc'); }); } public function getCoverUrlAttribute() { return $this->attachmentService->switchImgToAliOss($this->attributes['cover_img'], OssThumbnail::THUMBNAIL_100_Q90); } public function goodsTypes() { return $this->hasMany(self::class, 'parent_id', 'id')->with('goodsCategory'); } public function goodsCategory() { return $this->hasMany(GoodsCategory::class, 'category_id', 'id'); } }