From 35601144c80c4f4583bb88e646b40815ce3db263 Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Tue, 8 Jun 2021 09:40:59 +0200 Subject: [PATCH] - always get bas_domain for creating doi subdomain routes/web.php --- routes/web.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index a8cf9a4..35d4c5a 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,9 +16,19 @@ use Illuminate\Support\Facades\Route; $base_domain = config('app.url'); $alias_domain = config('app.alias_url'); +function get_domain($host){ + $myhost = strtolower(trim($host)); + $count = substr_count($myhost, '.'); + if($count === 2){ + if(strlen(explode('.', $myhost)[1]) > 3) $myhost = explode('.', $myhost, 2)[1]; + } else if($count > 2){ + $myhost = get_domain(explode('.', $myhost, 2)[1]); + } + return $myhost; + } Route::group([ - 'domain' => 'doi.' . $base_domain, + 'domain' => 'doi.' . get_domain($base_domain), 'as' => 'doi' ], function () { // $dataset_prefix = config('tethys.datacite_prefix');