@php $workspace = app()->bound('current_workspace') ? app('current_workspace') : null; $workspaces = auth()->check() ? auth()->user()->workspaces()->orderBy('name')->get() : collect(); $wsUlid = $workspace?->ulid; $nav = $workspace ? [ [ 'label' => 'Dashboard', 'route' => 'w.dashboard', 'params' => [$wsUlid], 'match' => 'w.dashboard', 'icon' => 'dashboard', ], [ 'label' => 'Links', 'route' => 'w.links.index', 'params' => [$wsUlid], 'match' => 'w.links.*', 'icon' => 'links', ], [ 'label' => 'QR Codes', 'route' => 'w.qr.index', 'params' => [$wsUlid], 'match' => 'w.qr.*', 'icon' => 'qr', ], [ 'label' => 'Link-in-Bio', 'route' => 'w.bio.index', 'params' => [$wsUlid], 'match' => 'w.bio.*', 'icon' => 'bio', ], [ 'label' => 'Analytics', 'route' => 'w.analytics.index', 'params' => [$wsUlid], 'match' => 'w.analytics.*', 'icon' => 'analytics', ], [ 'label' => 'Domains', 'route' => 'w.domains.index', 'params' => [$wsUlid], 'match' => 'w.domains.*', 'icon' => 'domains', ], [ 'label' => 'Settings', 'route' => 'w.settings.index', 'params' => [$wsUlid], 'match' => 'w.settings.*', 'icon' => 'settings', ], [ 'label' => 'Billing', 'route' => 'w.billing.index', 'params' => [$wsUlid], 'match' => 'w.billing.*', 'icon' => 'billing', ], [ 'label' => 'Team', 'route' => 'w.team.index', 'params' => [$wsUlid], 'match' => 'w.team.*', 'icon' => 'team', ], ] : [ [ 'label' => 'Dashboard', 'route' => 'dashboard', 'params' => [], 'match' => 'dashboard', 'icon' => 'dashboard', ], ]; // Plan usage $plan = $workspace?->plan; $linksUsed = $workspace ? $workspace->links()->count() : 0; $linkLimit = $plan?->link_limit ?? 50; $usagePct = $linkLimit > 0 ? min(100, round(($linksUsed / $linkLimit) * 100)) : 0; // User initials $userName = auth()->user()?->name ?? ''; $initials = collect(explode(' ', trim($userName)))->map(fn($w) => strtoupper(substr($w, 0, 1)))->take(2)->implode(''); @endphp