Changeset View
Changeset View
Standalone View
Standalone View
src/app/Utils.php
Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | public static function uiEnv(): array | ||||
$env = \app('config')->getMany($opts); | $env = \app('config')->getMany($opts); | ||||
$countries = include resource_path('countries.php'); | $countries = include resource_path('countries.php'); | ||||
$env['countries'] = $countries ?: []; | $env['countries'] = $countries ?: []; | ||||
$isAdmin = strpos(request()->getHttpHost(), 'admin.') === 0; | $isAdmin = strpos(request()->getHttpHost(), 'admin.') === 0; | ||||
$env['jsapp'] = $isAdmin ? 'admin.js' : 'user.js'; | $env['jsapp'] = $isAdmin ? 'admin.js' : 'user.js'; | ||||
$env['paymentProvider'] = \config('services.payment_provider'); | |||||
$env['stripePK'] = \config('services.stripe.public_key'); | |||||
return $env; | return $env; | ||||
} | } | ||||
/** | /** | ||||
* Create self URL | |||||
* | |||||
* @param string $route Route/Path | |||||
* | |||||
* @return string Full URL | |||||
*/ | |||||
public static function serviceUrl(string $route): string | |||||
{ | |||||
$url = \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; | |||||
} | |||||
/** | |||||
* Email address (login or alias) validation | * Email address (login or alias) validation | ||||
* | * | ||||
* @param string $email Email address | * @param string $email Email address | ||||
* @param \App\User $user The account owner | * @param \App\User $user The account owner | ||||
* @param bool $is_alias The email is an alias | * @param bool $is_alias The email is an alias | ||||
* | * | ||||
* @return string Error message on validation error | * @return string Error message on validation error | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |