diff --git a/app/Repositories/Shop/ArticleNatures.php b/app/Repositories/Shop/ArticleNatures.php index 8d4d4eda..d7a5b647 100644 --- a/app/Repositories/Shop/ArticleNatures.php +++ b/app/Repositories/Shop/ArticleNatures.php @@ -49,7 +49,7 @@ class ArticleNatures { Medias::deleteImages($nature, $collection); - return Medias::storeImage($nature, $file, $collection); + return $file ? Medias::storeImage($nature, $file, $collection) : false; } public static function getProductType($id) diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index bc0d4f1e..2727bf75 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -346,6 +346,9 @@ class Articles switch ($product_type) { case 'App\Models\Botanic\Variety': $product = Varieties::get($product_id); + if (!$product) { + break; + } $data[] = [ 'name' => 'Espèces', 'description' => Species::getDescription($product->specie_id), @@ -359,6 +362,9 @@ class Articles break; case 'App\Models\Botanic\Specie': $product = Species::get($product_id); + if (!$product) { + break; + } $data[] = [ 'name' => 'Espèces', 'description' => $product->description, @@ -367,6 +373,9 @@ class Articles break; case 'App\Models\Shop\Merchandise': $product = Merchandises::get($product_id); + if (!$product) { + break; + } $data[] = [ 'name' => 'Marchandise', 'description' => $product->description,