[WIP] Finish the order process

This commit is contained in:
Ludovic CANDELLIER
2022-08-18 18:20:44 +02:00
parent 01f56204b7
commit 1880b25407
28 changed files with 375 additions and 245 deletions

View File

@@ -283,36 +283,7 @@ class Articles
public static function getInherited($id)
{
$article = Article::with('product.tags.tag_group')->findOrFail($id);
$product_type = $article->product_type;
switch ($product_type) {
case 'App\Models\Botanic\Variety':
$data[] = [
'name' => 'Espèces',
'description' => Species::getDescription($article->product->specie_id),
'tags' => Species::getTags($article->product->specie_id),
];
$data[] = [
'name' => 'Variétés',
'description' => $article->product->description,
'tags' => $article->product->tags->toArray()
];
break;
case 'App\Models\Botanic\Specie':
$data[] = [
'name' => 'Espèces',
'description' => $article->product->description,
'tags' => $article->product->tags->toArray()
];
break;
case 'App\Models\Shop\Merchandise':
$data[] = [
'name' => 'Marchandise',
'description' => $article->product->description,
'tags' => $article->product->tags->toArray(),
];
break;
}
return $data ?? [];
return self::getInheritedByProduct($article->product_id, $article->product_type);
}
public static function getInheritedByProduct($product_id, $product_type)