ultimatepos/Modules/Portal/Support/PortalLayoutConfig.php

59 lines
2.1 KiB
PHP

<?php
namespace Modules\Portal\Support;
use Illuminate\Support\Facades\View;
use Modules\Portal\Http\Controllers\Customer;
use Modules\Portal\Http\Controllers\Marketer;
use Modules\Portal\Http\Controllers\Supplier;
class PortalLayoutConfig
{
public static function forType(string $portalType): array
{
$menus = [
'customer' => [
'menu' => 'portal-customer-sidebar',
'home' => action([Customer\DashboardController::class, 'index']),
'profile' => action([Customer\ProfileController::class, 'getProfile']),
'label' => __('portal::lang.customer_portal'),
'accent' => '#2563eb',
'accent_dark' => '#1d4ed8',
],
'supplier' => [
'menu' => 'portal-supplier-sidebar',
'home' => action([Supplier\DashboardController::class, 'index']),
'profile' => action([Supplier\ProfileController::class, 'getProfile']),
'label' => __('portal::lang.supplier_portal'),
'accent' => '#059669',
'accent_dark' => '#047857',
],
'marketer' => [
'menu' => 'portal-marketer-sidebar',
'home' => action([Marketer\DashboardController::class, 'index']),
'profile' => action([Marketer\ProfileController::class, 'getProfile']),
'label' => __('portal::lang.marketer_portal'),
'accent' => '#d97706',
'accent_dark' => '#b45309',
],
];
$cfg = $menus[$portalType] ?? $menus['customer'];
return [
'portal_type' => $portalType,
'portal_menu' => $cfg['menu'],
'portal_home' => $cfg['home'],
'portal_profile' => $cfg['profile'],
'portal_label' => $cfg['label'],
'portal_accent' => $cfg['accent'],
'portal_accent_dark' => $cfg['accent_dark'] ?? $cfg['accent'],
];
}
public static function shareForType(string $portalType): void
{
View::share(self::forType($portalType));
}
}