add methods to get icon on article natures
This commit is contained in:
@@ -20,24 +20,29 @@ class ArticleNatureController extends Controller
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$ret = ArticleNatures::store($request->all());
|
||||
$articleNature = ArticleNatures::store($request->all());
|
||||
ArticleNatures::storeIcon($articleNature, $request->file('icon'));
|
||||
|
||||
return redirect()->route('Admin.Shop.ArticleNatures.index');
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$data['article_nature'] = ArticleNatures::get($id);
|
||||
$data = [
|
||||
'article_nature' => ArticleNatures::get($id),
|
||||
];
|
||||
|
||||
return view('Admin.Shop.ArticleNatures.view', $data);
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$data['article_nature'] = ArticleNatures::get($id);
|
||||
$data['product_types'] = ArticleNatures::getProductTypes();
|
||||
// dump($data);
|
||||
// exit;
|
||||
$data = [
|
||||
'article_nature' => ArticleNatures::get($id),
|
||||
'product_types' => ArticleNatures::getProductTypes(),
|
||||
];
|
||||
$data['article_nature']['icon'] = ArticleNatures::getIcon($id);
|
||||
|
||||
return view('Admin.Shop.ArticleNatures.edit', $data);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,42 +33,21 @@ class CategoryController extends Controller
|
||||
]);
|
||||
if (count($articleNatures) === 1) {
|
||||
$articleNature = $articleNatures[0];
|
||||
} else {
|
||||
$articleNature = 'semences';
|
||||
}
|
||||
$productTypes = Articles::getProductTypesWithOffers([
|
||||
'category_id' => $categoryId,
|
||||
]);
|
||||
if (count($productTypes) === 1) {
|
||||
$productType = $productTypes[0];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$productType = ArticleNatures::getProductTypeBySlug($articleNature);
|
||||
}
|
||||
|
||||
switch ($articleNature) {
|
||||
case 'semences':
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 1;
|
||||
break;
|
||||
case 'plants':
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 2;
|
||||
break;
|
||||
case 'legumes':
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 3;
|
||||
break;
|
||||
default:
|
||||
if (!($productType ?? false)) {
|
||||
$productType = 'botanic';
|
||||
$articleNatureId = 1;
|
||||
$articleNature = 'semences';
|
||||
}
|
||||
break;
|
||||
}
|
||||
// $productType = ArticleNatures::getProductType($articleNatureId);
|
||||
// dump($productType);
|
||||
// dump($articleNatureId);
|
||||
// exit;
|
||||
|
||||
$articleNatureId = ArticleNatures::getIdBySlug($articleNature);
|
||||
}
|
||||
// exit;
|
||||
$data = [
|
||||
'category' => Categories::getFull($categoryId),
|
||||
'breadcrumb' => Categories::getAncestorsByCategory($categoryId),
|
||||
@@ -86,8 +65,6 @@ class CategoryController extends Controller
|
||||
]),
|
||||
'tags' => TagGroups::getWithTagsAndCountOffers($categoryId),
|
||||
];
|
||||
// dump($data);
|
||||
// exit;
|
||||
return view('Shop.Shelves.shelve', $data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user