Create tenant menu

I'm trying to limit the number of tenants that a user can create, I have this code inside TeamPolicy:
public function create(): bool
    {
        $user = Auth::user();
        $tenants = $user->team;
        if (count($tenants) < Filament::getTenant()->allowedTenants()) {
            return auth()->user()->role->name === 'administrador';
        }
        return false;
    }

The problem is, when the user attempts to create a new tenant (http://localhost/admin/new), the following code is returning null...

Filament::getTenant()

Any ideas?
Was this page helpful?