$image_url = $openfoodfacts_result->getData()['image_url'];
try {
$image_contents = file_get_contents($image_url);
$image_name = basename($image_url);
$local_path = "images/products/$image_name";
Storage::disk('public')->put($local_path, $image_contents);
$set('product_image_url', [$local_path]);
$livewire->dispatch('refreshFileUpload', 'product_image_url');
} catch (\Exception $e) {
dd($e);
}
$image_url = $openfoodfacts_result->getData()['image_url'];
try {
$image_contents = file_get_contents($image_url);
$image_name = basename($image_url);
$local_path = "images/products/$image_name";
Storage::disk('public')->put($local_path, $image_contents);
$set('product_image_url', [$local_path]);
$livewire->dispatch('refreshFileUpload', 'product_image_url');
} catch (\Exception $e) {
dd($e);
}