From acd9d99ccbd1c5addded6a42496c570f26cf12e6 Mon Sep 17 00:00:00 2001 From: Dustin Fraker Date: Sun, 20 Oct 2019 07:39:06 -0600 Subject: [PATCH] Add route helper This is a convenience method which makes testing assertions about where the application is redirecting to. --- src/Tenant.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Tenant.php b/src/Tenant.php index eb44466f..ac4dbf33 100644 --- a/src/Tenant.php +++ b/src/Tenant.php @@ -383,6 +383,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) {