where(['status' => 1])->orderBy('sort', 'desc'); }); } public function getGoodsTypesAttribute() { return self::query()->where(['parent_id' => $this->attributes['id']])->orderBy('sort', 'desc')->get()->toArray(); } }