Skip to content

Commit

Permalink
Corrigido bug para capturar subdominio da url
Browse files Browse the repository at this point in the history
  • Loading branch information
dlimars committed Jan 2, 2016
1 parent c7f465f commit fd3696c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/Routing/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,19 @@ private function mergeParameters($parameters = [])
*/
private function getSubDomainParameter()
{
if(\Route::current()) {
return \Route::input(config('tenant.subdomain'));
if(\Route::current() && ($param = \Route::input(config('tenant.subdomain'))) ) {
return $param;
}
return null;
return $this->extractSubdomainFromUrl();
}

/**
* Extract the subdomain from url
* @return string subdomain parameter value
*/
private function extractSubdomainFromUrl()
{
$subdomain = str_ireplace( "." . $this->tenantManager->getDomain(), "", \Request::getHost() );
return $subdomain;
}
}

0 comments on commit fd3696c

Please sign in to comment.