Changeset View
Changeset View
Standalone View
Standalone View
src/app/Utils.php
Show First 20 Lines • Show All 465 Lines • ▼ Show 20 Lines | private static function combine($input, $r, $index, $data, $i, &$output): void | ||||
// current is excluded, replace it with next (Note that i+1 | // current is excluded, replace it with next (Note that i+1 | ||||
// is passed, but index is not changed) | // is passed, but index is not changed) | ||||
self::combine($input, $r, $index, $data, $i + 1, $output); | self::combine($input, $r, $index, $data, $i + 1, $output); | ||||
} | } | ||||
/** | /** | ||||
* Create self URL | * Create self URL | ||||
* | * | ||||
* @param string $route Route/Path | * @param string $route Route/Path | ||||
* @param int|null $tenantId Current tenant | |||||
* | |||||
* @todo Move this to App\Http\Controllers\Controller | * @todo Move this to App\Http\Controllers\Controller | ||||
* | * | ||||
* @return string Full URL | * @return string Full URL | ||||
*/ | */ | ||||
public static function serviceUrl(string $route): string | public static function serviceUrl(string $route, $tenantId = null): string | ||||
{ | { | ||||
$url = \config('app.public_url'); | $url = \App\Tenant::getConfig($tenantId, 'app.public_url'); | ||||
if (!$url) { | if (!$url) { | ||||
$url = \config('app.url'); | $url = \App\Tenant::getConfig($tenantId, 'app.url'); | ||||
} | } | ||||
return rtrim(trim($url, '/') . '/' . ltrim($route, '/'), '/'); | 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 | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |