© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
Sjoerd24

User not linked to tenant > redirect to new tenant page

So the question if pretty straighforward, after a new user has registered in my Filament panel he/she is not yet linked to a tenant (if they are invited this is already arranged,but not every user is invited of course). The problem is I need to redirect a user that isn't linked to a tenant to go to (in my case) "clinic/new". I think the code should be something like this:

 user is logged in but not linked to a tenant, redirect to register clinic page
        if (!Filament::getTenant() && $request->url <> url('/clinic/new')) {
            return redirect('/clinic/new');
        }
 user is logged in but not linked to a tenant, redirect to register clinic page
        if (!Filament::getTenant() && $request->url <> url('/clinic/new')) {
            return redirect('/clinic/new');
        }

But where do I put this code? Stupid question probably but I cant figure it out. I tried a middleware but that doesn't seem to work, I suspect an 404 error is given earlier in the chain. Anybody any tips? btw: I use Shield with spatie permissions Teams for authentication.
Solution
Ok fixed it, the policy of my tenant (the create) you have to make an exception for new users. Now everything works. 🥲
Jump to solution
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

Redirect unauthorised tenant user to their default tenant
FilamentFFilament / ❓┊help
2y ago
Redirect to new slug after updating tenant name
FilamentFFilament / ❓┊help
3y ago
Redirect on the same page of another tenant on tenant switch
FilamentFFilament / ❓┊help
6mo ago
Attached user to a tenant
FilamentFFilament / ❓┊help
2y ago