Search code examples
phplaravelmulti-tenantwildcard-subdomainvoyager

Implementing Multi-tenancy in Laravel


I am using Laravel 5.4 with having Laravel Voyager Installed.

The main requirements of the project are to have the multi-tenant domain based application i.e. app.com and {client}.app.com

I have been trying to load configurations based on a subdomain and will act subdomain as the client code which worked fine on localhost but while I am pushing changes to live server things are not working

As a beginner in this scope, I am not sure how thing will work on the live environment, in terms of domain redirection and setting up options in middleware, or mainly how wildcard subdomain would work in laravel's subdomain routing


Solution

  • You can use this package: https://github.com/hyn/multi-tenant

    I've used this many times and can confirm it works extremely well. As an added bonus, there's a very detailed tutorial you can use to get going here: https://laravel-tenancy.com/docs/hyn/5.x/full-featured-tutorial