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:
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.
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. 