samedi 27 avril 2019

Multi-Tenancy Laravel with each Tenant having Dynamic Routes from Database

I'm planning on building a Multi-Tenant Application. All Tenants will admin their instance at example.com and all instances will be at {tenant}.example.com. They will also be able to point a domain to their instance using an A Record to the App Server.

The App will be modular in the sense that there will be modules that I will be able to activate for tenants to add functionality to their instance. The difficulty I'm facing is that each instance will therefore need to have it's own dynamic routing.

Let's say one instance has a shop module which can be accessed at tenant.example.com/shop and there will be /shop/products /shop/basket etc. Another tenant may want the Shop Module too but want to access it at /merchandise (/merchandise/products /merchandise/basket etc). And a third tenant does not have this module so won't have either of the previously mentioned endpoints. What would be the best way to go about this?

I have got the App to correctly route Tenants to a newly made tenants.php file in the Routes directory. From here I just need to be able to query the database to retrieve all the custom routes and populate the tenants.php file?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire