@php use App\Enums\AgentStatus;use App\Services\WalletService;$walletService = app(WalletService::class); $walletCardUser = auth()->user(); $walletCardCounterCashOutRoute = route('user.agent.index', ['tab' => 'counter-cashout']); if ($walletCardUser?->isAgent()) { $walletCardCounterCashOutAgent = $walletCardUser->agent() ->where('status', AgentStatus::APPROVED) ->where('qr_enabled', true) ->whereNotNull('qr_token') ->latest() ->first(); $walletCardCounterCashOutRoute = $walletCardCounterCashOutAgent?->qrCashOutUrl() ?? $walletCardCounterCashOutRoute; } $walletCardProfile = match (true) { $walletCardUser?->isMerchant() => [ 'role' => 'merchant', 'label' => __('Merchant Wallet'), 'primary_label' => __('Add Funds'), 'primary_icon' => 'fa-plus', 'primary_route' => route('user.deposit.create'), 'secondary_label' => __('Shops'), 'secondary_icon' => 'fa-store', 'secondary_route' => route('user.merchant.index'), ], $walletCardUser?->isAgent() => [ 'role' => 'agent', 'label' => __('Agent Wallet'), 'primary_label' => __('Cash-In'), 'primary_icon' => 'fa-wallet', 'primary_route' => route('user.agent.index', ['tab' => 'cash-in']), 'secondary_label' => __('Counter Cash-Out'), 'secondary_icon' => 'fa-money-bill-wave', 'secondary_route' => $walletCardCounterCashOutRoute, ], default => [ 'role' => 'user', 'label' => __('Personal Wallet'), 'primary_label' => __('Deposit'), 'primary_icon' => 'fa-plus', 'primary_route' => route('user.deposit.create'), 'secondary_label' => __('My Wallets'), 'secondary_icon' => 'fa-sliders', 'secondary_route' => route('user.wallet.index'), ], }; @endphp