2021-07-30 18:38:43 +02:00
|
|
|
<?php
|
|
|
|
|
2021-09-07 13:37:18 +02:00
|
|
|
/** @noinspection UnusedFunctionResultInspection */
|
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
use App\Http\Controllers\Controller;
|
2022-01-17 19:10:17 +01:00
|
|
|
use App\Http\Middleware\CheckConfigurationMiddleware;
|
2021-07-30 18:38:43 +02:00
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Web Routes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Here is where you can register web routes for your application. These
|
|
|
|
| routes are loaded by the RouteServiceProvider within a group which
|
|
|
|
| contains the "web" middleware group. Now create something great!
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::get('/', static fn () => redirect()->route('login'))
|
2022-01-17 19:10:17 +01:00
|
|
|
->middleware(CheckConfigurationMiddleware::class);
|
2021-12-07 16:35:14 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::middleware('guest')->group(static function () {
|
|
|
|
Route::inertia('login', 'LoginPage', ['external' => true])
|
|
|
|
->middleware('guest')
|
|
|
|
->name('login');
|
2021-12-14 12:34:17 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::inertia('reset', 'ResetPasswordPage', ['external' => true])
|
|
|
|
->middleware('guest')
|
|
|
|
->name('password.reset');
|
2021-12-14 11:55:23 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::inertia('setup', 'Setup/SetupPage', [
|
|
|
|
'languages' => cache()->rememberForever('app.languages', fn () => array_map(
|
|
|
|
static fn ($file) => basename($file, '.json'),
|
|
|
|
glob(lang_path('/*.json'), GLOB_NOSORT)
|
2021-12-07 19:26:59 +01:00
|
|
|
)),
|
2023-04-20 20:00:38 +02:00
|
|
|
'license' => cache()->rememberForever('app.license', fn () => file_get_contents(base_path('LICENSE'))),
|
2022-03-07 12:11:29 +01:00
|
|
|
'external' => true,
|
2022-01-17 19:10:17 +01:00
|
|
|
])
|
2023-04-20 20:00:38 +02:00
|
|
|
->middleware('guest', CheckConfigurationMiddleware::class)
|
|
|
|
->name('setup.index');
|
|
|
|
});
|
2021-12-07 19:26:59 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::patch('lang', [Controller::class, 'setLanguage'])->name('app.language');
|
2021-12-09 19:45:06 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::middleware('auth')->group(static function () {
|
|
|
|
Route::inertia('dashboard', 'Dashboard')
|
|
|
|
->middleware('auth')
|
|
|
|
->name('dashboard');
|
2021-12-07 19:26:59 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::inertia('users', 'Users/UsersRecords')
|
|
|
|
->middleware('auth')
|
|
|
|
->name('users.index');
|
2021-12-09 19:45:06 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::inertia('users/{id}', 'Users/UserRecord')
|
|
|
|
->middleware('auth')
|
|
|
|
->name('users.show');
|
2021-12-07 19:26:59 +01:00
|
|
|
});
|
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
Route::get('refresh_csrf', static fn () => function () {
|
|
|
|
session()->regenerate();
|
2021-12-14 19:22:51 +01:00
|
|
|
|
2023-04-20 20:00:38 +02:00
|
|
|
return response()->json(['token' => csrf_token()]);
|
|
|
|
})
|
|
|
|
->name('csrf.renew');
|