Changeset View
Changeset View
Standalone View
Standalone View
src/app/Utils.php
Show First 20 Lines • Show All 357 Lines • ▼ Show 20 Lines | class Utils | ||||
* | * | ||||
* @return array Configuration data | * @return array Configuration data | ||||
*/ | */ | ||||
public static function uiEnv(): array | public static function uiEnv(): array | ||||
{ | { | ||||
$countries = include resource_path('countries.php'); | $countries = include resource_path('countries.php'); | ||||
$req_domain = preg_replace('/:[0-9]+$/', '', request()->getHttpHost()); | $req_domain = preg_replace('/:[0-9]+$/', '', request()->getHttpHost()); | ||||
$sys_domain = \config('app.domain'); | $sys_domain = \config('app.domain'); | ||||
$path = request()->path(); | |||||
$opts = [ | $opts = [ | ||||
'app.name', | 'app.name', | ||||
'app.url', | 'app.url', | ||||
'app.domain', | 'app.domain', | ||||
'app.theme', | 'app.theme', | ||||
'app.webmail_url', | 'app.webmail_url', | ||||
'app.support_email', | 'app.support_email', | ||||
'mail.from.address' | 'mail.from.address' | ||||
]; | ]; | ||||
$env = \app('config')->getMany($opts); | $env = \app('config')->getMany($opts); | ||||
$env['countries'] = $countries ?: []; | $env['countries'] = $countries ?: []; | ||||
$env['view'] = 'root'; | $env['view'] = 'root'; | ||||
$env['jsapp'] = 'user.js'; | $env['jsapp'] = 'user.js'; | ||||
if ($req_domain == "admin.$sys_domain") { | if ($req_domain == "admin.$sys_domain") { | ||||
$env['jsapp'] = 'admin.js'; | $env['jsapp'] = 'admin.js'; | ||||
} elseif ($req_domain == "reseller.$sys_domain") { | |||||
$env['jsapp'] = 'reseller.js'; | |||||
} | } | ||||
$env['paymentProvider'] = \config('services.payment_provider'); | $env['paymentProvider'] = \config('services.payment_provider'); | ||||
$env['stripePK'] = \config('services.stripe.public_key'); | $env['stripePK'] = \config('services.stripe.public_key'); | ||||
$env['languages'] = \App\Http\Controllers\ContentController::locales(); | $env['languages'] = \App\Http\Controllers\ContentController::locales(); | ||||
$env['menu'] = \App\Http\Controllers\ContentController::menu(); | $env['menu'] = \App\Http\Controllers\ContentController::menu(); | ||||
return $env; | return $env; | ||||
} | } | ||||
} | } |