© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•12mo ago•
2 replies
Trauma Zombie

How to get current tenant in FilamentServiceProvider?

Hi guys, I want to dynamicaly set some NavigationItems based on current tenant. So I need to register them in service provider, but I am not sure, how to access current tenant, becuase this is not working:
    public function panel(Panel $panel): Panel
    {
        $stores = Filament::getTenant()->stores;

        return $panel
            ->navigationItems(
                $stores->map(function (Store $store): NavigationItem {
                    return NavigationItem::make($store->name)
                        ->url(StoreResource::getUrl('view', ['record' => $store]))
                        ->parentItem(__('Stores'));
                })->toArray(),
            );
    }
    public function panel(Panel $panel): Panel
    {
        $stores = Filament::getTenant()->stores;

        return $panel
            ->navigationItems(
                $stores->map(function (Store $store): NavigationItem {
                    return NavigationItem::make($store->name)
                        ->url(StoreResource::getUrl('view', ['record' => $store]))
                        ->parentItem(__('Stores'));
                })->toArray(),
            );
    }
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How do you get the current tenant id?
FilamentFFilament / ❓┊help
3y ago
Get Tenant Url of non current Panel
FilamentFFilament / ❓┊help
15mo ago
Is there a way to get the current tenant in isTenantSubscriptionRequired()?
FilamentFFilament / ❓┊help
3y ago
Accessing the current tenant
FilamentFFilament / ❓┊help
3y ago