public function destroy(AttributeGroup $attributeGroup) { $this->attributeManager->getAttributeGroupRepository()->delete($attributeGroup); // recalculate stocks if necessary /*if ($attributeGroup->product->hasAttributeGroupStock() OR $attributeGroup->product->stocks()->count() > 1) { app(StockRepository::class)->recalculate($attributeGroup->product); }*/ return $this->success('delete'); }
public function index(Product $product) { $attributeGroups = $this->attributeManager->getAttributeGroupRepository()->with('attributeOptions')->whereSeller($this->shop())->findAll(); $attributeOptions = $product->attributeOptions()->get(['attribute_options.id'])->pluck('id'); return view('attribute::__shop.product.attributes', compact('product', 'attributeGroups', 'attributeOptions')); }