File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Komma/Shop/Bridges/SIdeBarShopMenuComposerBridge.php
<?php
namespace App\Komma\Shop\Bridges;
class SideBarShopMenuComposerBridge
{
/**
* Returns an array of Shop Specific Menu bar items.
*
* @param string $currentSectionSlug
* @return array
*/
public static function get(string $currentSectionSlug):array
{
$routeName = \Route::current()->getName();
$items = [];
$items[] = [
'name' => ucfirst(__('shop/products.products')),
'url' => route('products.index'),
'active' => ('products' == $currentSectionSlug)
];
$items[] = [
'name' => ucfirst(__('shop/products.product_groups')),
'url' => route('productgroups.index'),
'active' => ('productgroups' == $currentSectionSlug)
];
$items[] = [
'name' => ucfirst(__('shop/products.product_composites')),
'url' => route('productcomposites.index'),
'active' => ('productcomposites' == $currentSectionSlug)
];
$items[] = [
'name' => ucfirst(__('shop/categories.categories')),
'url' => route('categories.index'),
'active' => ('categories' == $currentSectionSlug)
];
$items[] = [
'name' => ucfirst(__('shop/orders.orders')),
'subItems' => array_merge(
[
[
'name' => ucfirst(__('shop/orders.overview')),
'url' => route('orders.index'),
'active' => $routeName == 'orders.index' || $routeName == 'orders.show'
]
]
// self::getOrderStatusMenuItems($routeName)
),
'active' => false
];
//TODO. The sidebar and section of this properties thing needs to be overhauled drastically to make it usefull
// $items[] = [
// 'name' => ucfirst(__('shop/properties.properties')),
// 'url' => route('properties.index'),
// 'active' => ('properties' == $currentSectionSlug)
// ];
//TODO. Make a sectio to manage discounts
// $items[] = [
// 'name' => ucfirst(__('shop/discounts.discounts')),
// 'url' => route('discounts.index', []),
// 'active' => ('discounts' == $currentSectionSlug)
// ];
return $items;
}
public static function getOrderStatusMenuItems(string $routeName)
{
$orderStatusSubItems = [];
foreach(__('shop/orders.status') as $key => $translation) {
$orderStatusSubItems[] = [
'name' => $translation,
'url' => route('orders.status', ['status' => $key]),
'active' => ($routeName == 'orders.status' && \Route::current()->parameter('status') == $key)
];
}
return $orderStatusSubItems;
}
}