Create tenant menu
I'm trying to limit the number of tenants that a user can create, I have this code inside TeamPolicy:
The problem is, when the user attempts to create a new tenant (http://localhost/admin/new), the following code is returning null...
Any ideas?
6 Replies
Why are you storing the allowed number of tenants on the tenant model? The code returns null because the create new page happens on a route without tenant awareness (slug/id).
The allowed number of tenants it's being stored on plan's model, that is a relationship between tenants and plans... how Can I do to make that rout aware of tenancy ?
Its weird to have a tenant limit on a plan, while a plan is linked to a tenant. What if a user is linked to two tenants, both have a plan, one has a limit of one tenant and the other of three tenants? This is a very odd pattern.
you are right, but then how you'd handle plans in multitenancy? linked to users? what if a user can invite user to his tenant?
No it’s very common to have the plan on the tenant and set feature limits etc based on the plan. However, usually you can create unlimited tenants but you would need a plan for each tenant to use features. Limiting the number of users per tenant for example is very common.
thanks!