From 038b2418f7150e2378aebeca61f3d558ff9eb707 Mon Sep 17 00:00:00 2001
From: Dan Brown <ssddanbrown@googlemail.com>
Date: Fri, 9 Nov 2018 21:29:30 +0000
Subject: [PATCH] Fixed baseURL helper when no app url is set

Also cleaned variable naming to be more obvious
---
 app/helpers.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/helpers.php b/app/helpers.php
index aca832ea5..b0886d02b 100644
--- a/app/helpers.php
+++ b/app/helpers.php
@@ -94,12 +94,12 @@ function baseUrl($path, $forceAppDomain = false)
     }
 
     $path = trim($path, '/');
-    $trimBase = rtrim(config('app.url'), '/');
+    $base = rtrim(config('app.url'), '/');
 
     // Remove non-specified domain if forced and we have a domain
     if ($isFullUrl && $forceAppDomain) {
-        if (strpos($path, $trimBase) === 0) {
-            $path = trim(substr($path, strlen($trimBase) - 1));
+        if (!empty($base) && strpos($path, $base) === 0) {
+            $path = trim(substr($path, strlen($base) - 1));
         }
         $explodedPath = explode('/', $path);
         $path = implode('/', array_splice($explodedPath, 3));
@@ -110,7 +110,7 @@ function baseUrl($path, $forceAppDomain = false)
         return url($path);
     }
 
-    return $trimBase . '/' . $path;
+    return $base . '/' . $path;
 }
 
 /**