1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 08:44:04 +00:00

Add route helper

This is a convenience method which makes testing assertions about where the application is redirecting to.
This commit is contained in:
Dustin Fraker 2019-10-20 07:39:06 -06:00 committed by GitHub
parent 6fdc041f88
commit acd9d99ccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -384,6 +384,23 @@ class Tenant implements ArrayAccess
return $result;
}
/**
* Get a route specific to this tenant.
*
* @param String $path
* @return string
*/
public function route($path)
{
$path = $path[0] !== '/' ? '/'.$path : $path;
$url = $this->app->config->get('app.url');
$subdomain = $this->domains[0];
$scheme = parse_url($url, PHP_URL_SCHEME);
return sprintf('%s://%s%s', $scheme, $subdomain, $path);
}
public function __get($key)
{
return $this->get($key);