I am trying to create a multi tenant application.
In other words I have a website, but it has multiple different versions of it with different branding, env variables and database connections. These sites are:
- sites1.test
- sites2.test
The easiest way I can think of doing this in Laravel is by having 2 different env files: .env.site1
and .env.site2
This means for artisan commands I can simply do:
artisan migrate --env=site1
for site 1 commandsartisan migrate --env=site2
for site 2 commands
The issue I have is for HTTP requests. How can I configure laravel so that it:
- Uses
.env.site1
when on site1.test - Uses
.env.site2
when on site.test
I also think there maybe some issues when caching the .env
file.
Also, is there a potentially a better way to do multi-tenancy.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire