From 83942d9646614326f0bf61e224898553a8c8e793 Mon Sep 17 00:00:00 2001 From: ankitcodes4u Date: Sat, 20 Sep 2025 12:55:37 +0545 Subject: [PATCH] fix: type error in tenant menu when current tenant is null --- .../filament/components/tenant-menu.blade.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/resources/views/filament/components/tenant-menu.blade.php b/resources/views/filament/components/tenant-menu.blade.php index 2df3b0f..f029ee0 100644 --- a/resources/views/filament/components/tenant-menu.blade.php +++ b/resources/views/filament/components/tenant-menu.blade.php @@ -1,14 +1,17 @@ @php + use Illuminate\Database\Eloquent\Model; + $currentTenant = filament()->getTenant(); - $currentTenantName = filament()->getTenantName($currentTenant); + $currentTenantName = $currentTenant ? filament()->getTenantName($currentTenant) : null; - $canSwitchTenants = count( + $canSwitchTenants = $currentTenant ? count( $tenants = array_filter( filament()->getUserTenants(filament()->auth()->user()), - fn(\Illuminate\Database\Eloquent\Model $tenant): bool => !$tenant->is($currentTenant), + fn(Model $tenant): bool => $tenant && !$tenant->is($currentTenant), ), - ); + ) : 0; @endphp +@if($currentTenant)