change icons, css, add routing to merchandise, add mail templater, fixes

This commit is contained in:
Ludovic CANDELLIER
2023-02-12 23:34:48 +01:00
parent 8313e25f2e
commit f2f4788ce1
71 changed files with 1486 additions and 154 deletions

View File

@@ -3,6 +3,10 @@
namespace App\Repositories\Shop;
use App\Models\Shop\ArticleNature;
use App\Models\Shop\Article;
use App\Models\Botanic\Specie;
use App\Models\Botanic\Variety;
use App\Models\Shop\Merchandise;
class ArticleNatures
{
@@ -11,9 +15,36 @@ class ArticleNatures
return ArticleNature::get()->pluck('name', 'id')->toArray();
}
public static function getOptionsByMerchandise()
public static function getProductType($id)
{
return self::getOptionsByProductType(2);
$type = self::get($id)->product_type ?? false;
return $type ? self::getProductTypes()[$type] : false;
}
public static function getProductTypeName($type)
{
return self::getProductTypes()[$type] ?? false;
}
public static function getProductTypeByModel($model)
{
switch ($model) {
case Specie::class:
$type = 1;
break;
case Variety::class:
$type = 1;
break;
case Merchandise::class:
$type = 2;
break;
}
return $type ?? false;
}
public static function getProductTypes()
{
return ['', 'botanic', 'merchandise'];
}
public static function getOptionsByBotanic()
@@ -21,9 +52,30 @@ class ArticleNatures
return self::getOptionsByProductType(1);
}
public static function getOptionsByMerchandise()
{
return self::getOptionsByProductType(2);
}
public static function getOptionsByProductTypeModel($model)
{
$type = self::getProductTypeByModel($model);
return self::getOptionsByProductType($type);
}
public static function getOptionsByProductType($type)
{
return ArticleNature::byProductType($type)->get()->pluck('name', 'id')->toArray();
return self::getByProductType($type)->pluck('name', 'id')->toArray();
}
public static function getByProductType($type)
{
return ArticleNature::byProductType($type)->get();
}
public static function getByCategory($category_id)
{
return Article::byCategory($category_id)->select('article_nature_id')->distinct()->get();
}
public static function getAll()