feat: create ProductService to handle product, variant, and attribute management operations

This commit is contained in:
2026-06-29 12:04:14 -03:00
parent 0206ee2985
commit cd420e02d8

View File

@@ -166,8 +166,12 @@ class ProductService
*/
protected function syncImages(ProductVariant $variant, array $images): void
{
// Detach any existing attachments before replacing them
// Detach pivot record and delete attachment from S3 and database
$existing = $variant->attachments()->get();
$variant->attachments()->detach();
foreach ($existing as $attachment) {
$this->attachmentService->delete($attachment);
}
$attachmentIds = [];