Minor fixes, coding standards

This commit is contained in:
Ludovic CANDELLIER
2021-11-01 00:50:10 +01:00
parent e356b3fcda
commit 8aaab4345f
47 changed files with 133 additions and 114 deletions

View File

@@ -25,7 +25,7 @@ class Articles
public static function getOptions()
{
return Article::orderBy('name','asc')->pluck('name','id')->toArray();
return Article::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
}
public static function getOptionsWithNature()
@@ -78,14 +78,30 @@ class Articles
$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()];
$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()];
$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()];
$data[] = [
'name' => 'Marchandise',
'description' => $article->product->description,
'tags' => $article->product->tags->toArray(),
];
break;
}
return $data;
@@ -96,16 +112,32 @@ class Articles
switch ($product_type) {
case 'App\Models\Botanic\Variety':
$product = Varieties::get($product_id);
$data[] = ['name' => 'Espèces', 'description' => Species::getDescription($product->specie_id), 'tags' => Species::getTags($product->specie_id)];
$data[] = ['name' => 'Variétés', 'description' => $product->description, 'tags' => $product->tags->toArray()];
$data[] = [
'name' => 'Espèces',
'description' => Species::getDescription($product->specie_id),
'tags' => Species::getTags($product->specie_id),
];
$data[] = [
'name' => 'Variétés',
'description' => $product->description,
'tags' => $product->tags->toArray(),
];
break;
case 'App\Models\Botanic\Specie':
$product = Species::get($product_id);
$data[] = ['name' => 'Espèces', 'description' => $product->description, 'tags' => $product->tags->toArray()];
$data[] = [
'name' => 'Espèces',
'description' => $product->description,
'tags' => $product->tags->toArray(),
];
break;
case 'App\Models\Shop\Merchandise':
$product = Merchandises::get($product_id);
$data[] = ['name' => 'Marchandise', 'description' => $product->description, 'tags' => $product->tags->toArray()];
$data[] = [
'name' => 'Marchandise',
'description' => $product->description,
'tags' => $product->tags->toArray()
];
break;
}
return $data;