public function update(UpdateProduct $request, Product $id): RedirectResponse 	{ 		$id->update([ 			'name' => $request->name, 			'extra_name' => $request->extra_name, 			'price' => $request->price, 			'description' => $request->description, 			'active' => $request->boolean('active'), 			'gratis' => $request->boolean('gratis'), 			'piktograms' => $request->piktograms, 			'harvest' => $request->harvest, 			// 'category_id' => $request->category_id, 			'variant_label' => $request->variant_label, 			'unavailable' => $request->boolean('unavailable'), 			'is_free_after_certain_quantity' => $request->boolean('is_free_after_certain_quantity'), 			'short_description' => $request->short_description, 			'sync_stock' => $request->boolean('sync_stock'), 			'quantity' => $request->quantity, 			'weight' => $request->weight, 			'stock' => $request->stock ?? 0, 			'price_per_unit_of_measure' => $request->price_per_unit_of_measure, 			'unit_of_measure' => $request->unit_of_measure, 			'alternative_unit_of_measure' => $request->alternative_unit_of_measure, 			'conversion_to_quantity' => $request->conversion_to_quantity, 			'code' => $request->code, 			'seo_name' => $request->seo_name, 			'seo_description' => $request->seo_description, 		]);  		$tagsEn = $request->tags_en;  		$id->syncTagsByName($request->tags, function (Tag $tag, ?int $index = null) use ($tagsEn): void { 			$tagsEn ??= [];  			if (is_string($tagsEn)) { 				$delimiter = Product::getTagDelimiter(); 				$tagsEn = explode(empty($delimiter) ? ' ' : $delimiter, $tagsEn); 			}  			$tag->updateTranslations([ 				'name' => [ 					'en' => $tagsEn[$index] ?? null, 				], 			]); 		});  		$id->updateTranslations([ 			'name' => [ 				'en' => $request->name_en, 			], 			'extra_name' => [ 				'en' => $request->extra_name_en, 			], 			'slug' => [ 				'en' => $id->slugTranslationUpdateHandle($request->name_en), 			], 			'description' => [ 				'en' => $request->description_en, 			], 			'variant_label' => [ 				'en' => $request->variant_label_en, 			], 			'short_description' => [ 				'en' => $request->short_description_en, 			], 			'seo_name' => [ 				'en' => $request->seo_name_en, 			], 			'seo_description' => [ 				'en' => $request->seo_description_en, 			], 		]);  		$id->productCategories()->delete();  		foreach ($request->categories as $category) { 			$id->productCategories()->create([ 				'category_id' => $category, 				'vat' => $category == $request->vat_category ? true : false, 			]); 		}  		if ($request->categories) { 			$id->saveFilterValues($request->filters); 			$id->saveFilterTranslations('en', $request->filters, $request->filters_en); 		}  		$id->storage()->handle($request->media);  		// if (($variantsCount = count($request['variants'] ?? [])) == 0) { 		// 	$id->variants->each(function ($item) { 		// 		$item->delete(); 		// 	}); 		// } else { 		// 	$id->variants()->whereNotIn('id', $request['variant_ids'])->delete();  		// 	for ($i = 0; $i < $variantsCount; $i++) { 		// 		$variant = $id->variants()->updateOrCreate(['id' => $request['variant_ids'][$i]], [  		// 			'name' => $request['variants'][$i], 		// 			'price' => $request['variants_price'][$i], 		// 			'measure' => $request['variants_measure'][$i], 		// 			'weight' => $request['variants_weight'][$i], 		// 			'product_code' => $id->code,  		// 		]);  		// 		$variant->updateTranslations([ 		// 			'name' => [ 		// 				'en' => $request['variants_en'][$i] 		// 			] 		// 		]); 		// 	} 		// }  		return $this->redirectFromSave('products.list'); 	}