gecche/laravel-multidomain

.env.domain.com doesnt get loaded or read

Closed this issue · 6 comments

#92

Same issue Hear @edwinsmasher Please reopen it again

Could you check if the SERVER_NAME server variable is instantiated in your execution environment?
If not you can try to switch for example to HTTP_HOST, following the instructions in the docs in the section:
"Customizing the detection of HTTP domains"

Could you check if the SERVER_NAME server variable is instantiated in your execution environment? If not you can try to switch for example to HTTP_HOST, following the instructions in the docs in the section: "Customizing the detection of HTTP domains"

I have followed all the instructions but not working as excepted

below both code are not working

str_replace('{app_name}', env('APP_NAME'), - Showing No Data
{{ config('app.name', 'Laravel') }} - Showing from env

when I delete env file showing 500 error

You can Check my repo: Repo Link

str_replace('{app_name}', env('APP_NAME') - HomePage Footer - Code in Helper
{{ config('app.name', 'Laravel') }} - in layouts app & guest

Hi,

I have seen your repo, but, as pointed out in the "Customizing the detection of HTTP domains" section in the docs, could you try to put this snippet in the bootstrap/app.php file?

$domainParams = [
    'domain_detection_function_web' => function() {
        return \Illuminate\Support\Arr::get($_SERVER,'HTTP_HOST');
    }
];

//$app = new Illuminate\Foundation\Application(
$app = new Gecche\Multidomain\Foundation\Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__), null, $domainParams
);

Hi,

I have seen your repo, but, as pointed out in the "Customizing the detection of HTTP domains" section in the docs, could you try to put this snippet in the bootstrap/app.php file?

$domainParams = [
    'domain_detection_function_web' => function() {
        return \Illuminate\Support\Arr::get($_SERVER,'HTTP_HOST');
    }
];

//$app = new Illuminate\Foundation\Application(
$app = new Gecche\Multidomain\Foundation\Application(
    $_ENV['APP_BASE_PATH'] ?? dirname(__DIR__), null, $domainParams
);

Thanks, Brother, It is Working Now

few Doubts

  1. Will it work with https also
  2. Migration If change DB for Domain how to Migrate it.
    I tried php artisan migrate --seed --domain=medecare.test but was not able to migrate it migrates from .env not from .env.medecare.test

1 - Will it work with https also

Yes

2 - Migration If change DB for Domain how to Migrate it.
I tried php artisan migrate --seed --domain=medecare.test but was not able to migrate it migrates from .env not from .env.medecare.test

All the laravel commands work with the domain option. However you can't use the --seed option because it launches another command internally without the domain option

Cheers

Thanks Brother