@props([
'icon' => null,
'currentTenant' => null,
])
@php
$currentTenantName = filament()->getTenantName($currentTenant);
$currentCompany = auth()->user()->currentCompany;
$currentCompanyOwner = $currentCompany->owner;
$items = filament()->getTenantMenuItems();
$profileItem = $items['profile'] ?? null;
$profileItemUrl = $profileItem?->getUrl();
$registrationItem = $items['register'] ?? null;
$registrationItemUrl = $registrationItem?->getUrl();
$isRegistrationItemVisible = $registrationItem?->isVisible() ?? true;
$hasRegistrationItem = ((filament()->hasTenantRegistration() && filament()->getTenantRegistrationPage()::canView()) || filled($registrationItemUrl)) && $isRegistrationItemVisible;
$canSwitchTenants = count($tenants = array_filter(
filament()->getUserTenants(filament()->auth()->user()),
fn (\Illuminate\Database\Eloquent\Model $tenant): bool => ! $tenant->is($currentTenant),
));
@endphp
@if($currentTenant)
@endif
@if($canSwitchTenants)
@foreach($tenants as $tenant)
@endforeach
@endif
@if($hasRegistrationItem)
@endif