feat: refactor product attributes handling to use product_attribute table and update related models and requests

This commit is contained in:
2026-06-30 16:35:56 -03:00
parent 191a40fcb9
commit cb15905c46
15 changed files with 189 additions and 63 deletions

View File

@@ -112,7 +112,7 @@ class ProductService
$this->syncVariantImages($variant, $images);
}
return $variant->load(['product', 'definitions.attribute.options', 'attachments']);
return $variant->load(['product', 'definitions.productAttribute.attribute.options', 'attachments']);
});
}
@@ -136,7 +136,7 @@ class ProductService
$this->syncVariantImages($updatedVariant, $images);
}
return $updatedVariant->load(['product', 'definitions.attribute.options', 'attachments']);
return $updatedVariant->load(['product', 'definitions.productAttribute.attribute.options', 'attachments']);
});
}
@@ -291,7 +291,7 @@ class ProductService
$selectedVariantQuery = $product->variants()
->with([
'attachments',
'definitions.attribute.options',
'definitions.productAttribute.attribute.options',
]);
$selectedVariant = $variantId !== null
@@ -302,7 +302,7 @@ class ProductService
$selectedVariant = $product->variants()
->with([
'attachments',
'definitions.attribute.options',
'definitions.productAttribute.attribute.options',
])
->first();
}