2FAuth/app/Http/Controllers/SinglePageController.php

38 lines
1.4 KiB
PHP
Raw Normal View History

2019-05-28 17:29:15 +02:00
<?php
namespace App\Http\Controllers;
2022-11-22 15:15:52 +01:00
use App\Events\ScanForNewReleaseCalled;
2022-07-30 17:51:02 +02:00
use App\Facades\Settings;
use Illuminate\Support\Facades\App;
2019-05-28 17:29:15 +02:00
class SinglePageController extends Controller
{
/**
* return the main view
2022-11-22 15:15:52 +01:00
*
* @return \Illuminate\Contracts\View\View|\Illuminate\Contracts\View\Factory
2019-05-28 17:29:15 +02:00
*/
public function index()
{
event(new ScanForNewReleaseCalled());
2023-01-25 16:58:30 +01:00
$subdir = config('2fauth.config.appSubdirectory') ? '/' . config('2fauth.config.appSubdirectory') : '';
2021-12-01 13:47:20 +01:00
return view('landing')->with([
'theme' => Settings::get('theme'),
2022-07-30 17:51:02 +02:00
'appSettings' => Settings::all()->toJson(),
2022-11-22 15:15:52 +01:00
'appConfig' => collect([
'proxyAuth' => config('auth.defaults.guard') === 'reverse-proxy-guard' ? true : false,
'proxyLogoutUrl' => config('2fauth.config.proxyLogoutUrl') ? config('2fauth.config.proxyLogoutUrl') : false,
2023-01-25 16:58:30 +01:00
'subdirectory' => $subdir,
])->toJson(),
2023-01-25 16:58:30 +01:00
'subdirectory' => $subdir,
2022-11-22 15:15:52 +01:00
'lang' => App::currentLocale(),
'isDemoApp' => config('2fauth.config.isDemoApp') ? 'true' : 'false',
'isTestingApp' => config('2fauth.config.isTestingApp') ? 'true' : 'false',
'locales' => collect(config('2fauth.locales'))->toJson(), /** @phpstan-ignore-line */
2021-12-01 13:47:20 +01:00
]);
2019-05-28 17:29:15 +02:00
}
}