2021-07-30 18:38:43 +02:00
|
|
|
<?php
|
|
|
|
|
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;
|
2023-07-02 13:56:16 +02:00
|
|
|
use App\Http\Middleware\LocaleMiddleware;
|
|
|
|
use App\Http\Middleware\RedirectIfAuthenticated;
|
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'))
|
2023-07-02 13:56:16 +02:00
|
|
|
->middleware(CheckConfigurationMiddleware::class)
|
|
|
|
/** @psalm-suppress PossiblyInvalidMethodCall */
|
|
|
|
->withoutMiddleware([LocaleMiddleware::class, RedirectIfAuthenticated::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', [
|
2023-05-07 17:02:00 +02:00
|
|
|
'languages' => app(Controller::class)->getLanguages(),
|
|
|
|
'license' => cache()->rememberForever('app.license', static 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-07-02 13:56:16 +02:00
|
|
|
->middleware(CheckConfigurationMiddleware::class)
|
|
|
|
->withoutMiddleware([LocaleMiddleware::class, RedirectIfAuthenticated::class])
|
2023-04-20 20:00:38 +02:00
|
|
|
->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-05-07 17:02:00 +02:00
|
|
|
Route::get('refresh_csrf', static fn () => static function () {
|
2023-04-20 20:00:38 +02:00
|
|
|
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');
|