From 2040a9d260863161395d59c1238671854835595f Mon Sep 17 00:00:00 2001 From: Arno Kaimbacher Date: Tue, 8 Jun 2021 09:59:39 +0200 Subject: [PATCH] - move helper functions inside app\Helpers\utils.php (e.g. get_domain --- app/Helpers/utils.php | 19 +++++++++++++++++-- routes/web.php | 11 ----------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/app/Helpers/utils.php b/app/Helpers/utils.php index 01ea031..7892505 100644 --- a/app/Helpers/utils.php +++ b/app/Helpers/utils.php @@ -1,7 +1,7 @@ 3) { + $myhost = explode('.', $myhost, 2)[1]; + } + + } else if ($count > 2) { + $myhost = get_domain(explode('.', $myhost, 2)[1]); + } + return $myhost; +} diff --git a/routes/web.php b/routes/web.php index 35d4c5a..b590567 100644 --- a/routes/web.php +++ b/routes/web.php @@ -16,17 +16,6 @@ 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.' . get_domain($base_domain), 'as' => 'doi'