This commit is contained in:
Marcel Pociot
2020-05-04 21:30:21 +02:00
parent ecc5705bab
commit 120e9cbd75

View File

@@ -10,10 +10,22 @@ class ShareCurrentWorkingDirectoryCommand extends ShareCommand
public function handle()
{
$this->input->setArgument('host', basename(getcwd()).'.test');
$this->input->setArgument('host', basename(getcwd()).'.'.$this->detectTld());
$this->input->setOption('subdomain', basename(getcwd()));
parent::handle();
}
protected function detectTld(): string
{
$valetConfigFile = $_SERVER['HOME'] . DIRECTORY_SEPARATOR . '.config' . DIRECTORY_SEPARATOR . 'valet' . DIRECTORY_SEPARATOR . 'config.json';
if (file_exists($valetConfigFile)) {
$valetConfig = json_decode(file_get_contents($valetConfigFile));
return $valetConfig->tld;
}
return 'test';
}
}