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 getGoodsCategoryIdsAttribute() { return GoodsCategory::query()->where(['category_id' => $this->attributes['id']])->orderBy('sort', 'desc')->pluck('id'); } public function getCoverUrlAttribute() { return $this->attachmentService->switchImgToAliOss($this->attributes['cover_img']); } }