fix on product null
This commit is contained in:
@@ -49,7 +49,7 @@ class ArticleNatures
|
|||||||
{
|
{
|
||||||
Medias::deleteImages($nature, $collection);
|
Medias::deleteImages($nature, $collection);
|
||||||
|
|
||||||
return Medias::storeImage($nature, $file, $collection);
|
return $file ? Medias::storeImage($nature, $file, $collection) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getProductType($id)
|
public static function getProductType($id)
|
||||||
|
|||||||
@@ -346,6 +346,9 @@ class Articles
|
|||||||
switch ($product_type) {
|
switch ($product_type) {
|
||||||
case 'App\Models\Botanic\Variety':
|
case 'App\Models\Botanic\Variety':
|
||||||
$product = Varieties::get($product_id);
|
$product = Varieties::get($product_id);
|
||||||
|
if (!$product) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'name' => 'Espèces',
|
'name' => 'Espèces',
|
||||||
'description' => Species::getDescription($product->specie_id),
|
'description' => Species::getDescription($product->specie_id),
|
||||||
@@ -359,6 +362,9 @@ class Articles
|
|||||||
break;
|
break;
|
||||||
case 'App\Models\Botanic\Specie':
|
case 'App\Models\Botanic\Specie':
|
||||||
$product = Species::get($product_id);
|
$product = Species::get($product_id);
|
||||||
|
if (!$product) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'name' => 'Espèces',
|
'name' => 'Espèces',
|
||||||
'description' => $product->description,
|
'description' => $product->description,
|
||||||
@@ -367,6 +373,9 @@ class Articles
|
|||||||
break;
|
break;
|
||||||
case 'App\Models\Shop\Merchandise':
|
case 'App\Models\Shop\Merchandise':
|
||||||
$product = Merchandises::get($product_id);
|
$product = Merchandises::get($product_id);
|
||||||
|
if (!$product) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'name' => 'Marchandise',
|
'name' => 'Marchandise',
|
||||||
'description' => $product->description,
|
'description' => $product->description,
|
||||||
|
|||||||
Reference in New Issue
Block a user