Fixed login 'intended' redirect for custom urls.

Also changed social account detach wording.
This commit is contained in:
Dan Brown
2016-08-21 14:49:40 +01:00
parent 437dce7756
commit f8a299caee
3 changed files with 15 additions and 5 deletions

View File

@ -64,13 +64,21 @@ function setting($key, $default = false)
/**
* Helper to create url's relative to the applications root path.
* @param $path
* @param string $path
* @param bool $forceAppDomain
* @return string
*/
function baseUrl($path)
function baseUrl($path, $forceAppDomain = false)
{
if (strpos($path, 'http') === 0) return $path;
$isFullUrl = strpos($path, 'http') === 0;
if ($isFullUrl && !$forceAppDomain) return $path;
$path = trim($path, '/');
if ($isFullUrl && $forceAppDomain) {
$explodedPath = explode('/', $path);
$path = implode('/', array_splice($explodedPath, 3));
}
return rtrim(config('app.url'), '/') . '/' . $path;
}