I have written a backend in Laravel which I need to deploy twice on the same physical server. I need to use two different databases for these, but as they are on the same server I cannot use the built-in host detection in Laravel.
For the moment, I have "fixed" the issue by wrapping my configuration files in this code:
if ($_SERVER["HTTP_HOST"] === "example.com") {
return config array...
} else if ($_SERVER["HTTP_HOST"] === "example.net") {
return config array...
}
But this breaks artisan, so no more php artisan down|up
or php artisan cache:clear
.
There must be a better way to achieve this, no?