Changeset View
Changeset View
Standalone View
Standalone View
src/app/Utils.php
Show First 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | class Utils | ||||
* Create self URL | * Create self URL | ||||
* | * | ||||
* @param string $route Route/Path | * @param string $route Route/Path | ||||
* | * | ||||
* @return string Full URL | * @return string Full URL | ||||
*/ | */ | ||||
public static function serviceUrl(string $route): string | public static function serviceUrl(string $route): string | ||||
{ | { | ||||
return trim(\config('app.public_url'), '/') . '/' . ltrim($route, '/'); | $url = \config('app.public_url'); | ||||
// TODO: Investigate why it does not work | if (!$url) { | ||||
$url = \config('app.url'); | |||||
$url = \secure_url($route); | |||||
$app_url = trim(\config('app.url'), '/'); | |||||
$pub_url = trim(\config('app.public_url'), '/'); | |||||
if ($pub_url != $app_url) { | |||||
$url = str_replace($app_url, $pub_url, $url); | |||||
} | } | ||||
return $url; | return rtrim(trim($url, '/') . '/' . ltrim($route, '/'), '/'); | ||||
} | } | ||||
/** | /** | ||||
* Create a configuration/environment data to be passed to | * Create a configuration/environment data to be passed to | ||||
* the UI | * the UI | ||||
* | * | ||||
* @todo For a lack of better place this is put here for now | * @todo For a lack of better place this is put here for now | ||||
* | * | ||||
Show All 19 Lines |