feat: create ProductService to handle product, variant, and attribute management operations
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user