Skip to content

Commit 620f1b3

Browse files
xiCO2ktaylorotwell
andauthored
Gets the default "tld" on install. (#336)
* Gets the default "tld" on install. * Update NewCommand.php --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent ad66a9a commit 620f1b3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/NewCommand.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,11 +745,31 @@ protected function verifyApplicationDoesntExist($directory)
745745
*/
746746
protected function generateAppUrl($name)
747747
{
748-
$hostname = mb_strtolower($name).'.test';
748+
$hostname = mb_strtolower($name).'.'.$this->getTld();
749749

750750
return $this->canResolveHostname($hostname) ? 'http://'.$hostname : 'http://localhost';
751751
}
752752

753+
/**
754+
* Get the TLD for the application.
755+
*
756+
* @return string
757+
*/
758+
protected function getTld()
759+
{
760+
foreach (['herd', 'valet'] as $tool) {
761+
$process = new Process([$tool, 'tld']);
762+
763+
$process->run();
764+
765+
if ($process->isSuccessful()) {
766+
return trim($process->getOutput());
767+
}
768+
}
769+
770+
return 'test';
771+
}
772+
753773
/**
754774
* Determine whether the given hostname is resolvable.
755775
*

0 commit comments

Comments
 (0)