@php if (auth('platform_admin')->check()) { $admin = auth('platform_admin')->user(); } elseif (auth('admin')->check()) { $admin = auth('admin')->user(); } else { $admin = null; } $adminRole = $admin ? $admin->role : null; $tenantId = $admin ? $admin->tenant_id : null; // Determine if user is platform owner $isPlatformOwner = ($adminRole === 'platform_owner'); // Determine if user is tenant user $isTenantUser = ($admin && !$isPlatformOwner && $tenantId !== null); // Get tenant slug from request $tenantSlug = request()->segment(1); $tenant = $tenantSlug ? \App\Models\Tenant::where('slug', $tenantSlug)->first() : null; // Check if tenant exists and is valid $isValidTenant = $tenant && $tenant->exists; // Get unread notification count for platform owner if ($isPlatformOwner) { $platformUnreadCount = \App\Models\PlatformNotification::where('is_read', false)->count(); } else { $platformUnreadCount = 0; } // Get unread notification count for tenant users (company_admin, sales) $tenantUnreadCount = 0; if ($isTenantUser && $adminRole === 'company_admin') { $tenantUnreadCount = \App\Models\UserNotification::where('is_read', false)->count(); } // Check if tenant setup is complete $tenantSetupComplete = false; if ($isTenantUser && $tenantId) { $tenantSetupComplete = \App\Models\TenantSetting::isSetupComplete($tenantId); } @endphp
{{-- ── LIVE SEARCH ──────────────────────────────────────── --}}
{{-- ── RIGHT ICONS ──────────────────────────────────────── --}}
{{-- ── PLATFORM OWNER BADGE ─────────────────────────── --}} @if($isPlatformOwner)
Platform Owner
@endif {{-- ── TENANT BADGE (for tenant users) ────────────────── --}} @if($isTenantUser && $tenant)
{{ $tenant->name }}
@endif {{-- ── NOTIFICATIONS BELL ────────────────────────────── --}} @if($admin && (($isTenantUser && $adminRole === 'company_admin') || $isPlatformOwner))
  • @endif {{-- ── MESSAGES (only for tenant users) ────────── --}} @if($admin && $isTenantUser && in_array($adminRole, ['company_admin', 'sales']))
  • @endif {{-- ── TENANT SETUP STATUS (only for company_admin with incomplete setup) ── --}} @if($admin && $isTenantUser && $adminRole === 'company_admin' && !$tenantSetupComplete)
  • ⚠️ Setup Incomplete
  • @endif
    {{-- ── PROFILE ─────────────────────────────────────────── --}}
    @if($admin && $admin->profile_photo)
    @else
    {{ $admin ? strtoupper(substr($admin->name, 0, 1)) : 'A' }}
    @endif
    @if($admin)
    {{ $admin->name }}
    {{ str_replace('_', ' ', $adminRole) }} @endif
    {{-- ── Platform Owner Links ─────────────────── --}} @if($isPlatformOwner) 🏠 Platform Dashboard 🏢 Manage Tenants 📋 Manage Plans 🔔 Notifications 💰 Payments @endif {{-- ── Tenant User Links ────────────────────── --}} @if($isTenantUser) 👤 My Profile @if($adminRole === 'company_admin') ⚙️ Settings 🎨 Appearance @endif @if($adminRole === 'broker') 📊 Broker Dashboard @endif @endif {{-- ── Logout (works for both) ───────────────── --}} @if($isPlatformOwner) 🚪 Log Out @else 🚪 Log Out @endif