@php $workspaces = $this->getWorkspaces(); $workspaceRoles = $this->workspaceRoles; $user = auth()->user(); $recommendedWorkspaceId = $user instanceof \App\Models\User ? (int) ($user->last_workspace_id ?? 0) : 0; if ($recommendedWorkspaceId > 0) { [$recommended, $other] = $workspaces->partition(fn ($workspace) => (int) $workspace->id === $recommendedWorkspaceId); $workspaces = $recommended->concat($other)->values(); } $roleColorMap = [ 'owner' => 'primary', 'manager' => 'info', 'operator' => 'gray', 'readonly' => 'gray', ]; $roleIconMap = [ 'owner' => 'heroicon-m-shield-check', 'manager' => 'heroicon-m-cog-6-tooth', 'operator' => 'heroicon-m-wrench-screwdriver', 'readonly' => 'heroicon-m-eye', ]; $canManageWorkspaces = false; if ($user instanceof \App\Models\User && $workspaces->count() > 0) { foreach ($workspaces as $ws) { if (($workspaceRoles[(int) $ws->id] ?? null) === 'owner') { $canManageWorkspaces = true; break; } } } @endphp @if ($workspaces->isEmpty())

No workspaces available

You don't have access to any workspace yet. Contact your administrator to get started.

@else

Select a workspace to continue.

@foreach ($workspaces as $workspace) @php $isRecommended = $recommendedWorkspaceId > 0 && (int) $workspace->id === $recommendedWorkspaceId; $role = $workspaceRoles[(int) $workspace->id] ?? null; $tenantCount = (int) ($workspace->tenants_count ?? 0); @endphp @endforeach
@if ($canManageWorkspaces) @endif
@endif