openstamanager/routes/web.php

66 lines
2.2 KiB
PHP
Raw Normal View History

2021-07-30 18:38:43 +02:00
<?php
use App\Http\Controllers\Controller;
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!
|
*/
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]);
Route::middleware('guest')->group(static function () {
Route::inertia('login', 'LoginPage', ['external' => true])
->middleware('guest')
->name('login');
2021-12-14 12:34:17 +01:00
Route::inertia('reset', 'ResetPasswordPage', ['external' => true])
->middleware('guest')
->name('password.reset');
2021-12-14 11:55:23 +01:00
Route::inertia('setup', 'Setup/SetupPage', [
'languages' => app(Controller::class)->getLanguages(),
'license' => cache()->rememberForever('app.license', static fn () => file_get_contents(base_path('LICENSE'))),
'external' => true,
])
2023-07-02 13:56:16 +02:00
->middleware(CheckConfigurationMiddleware::class)
->withoutMiddleware([LocaleMiddleware::class, RedirectIfAuthenticated::class])
->name('setup.index');
});
2021-12-07 19:26:59 +01:00
Route::patch('lang', [Controller::class, 'setLanguage'])->name('app.language');
Route::middleware('auth')->group(static function () {
Route::inertia('dashboard', 'Dashboard')
->middleware('auth')
->name('dashboard');
2021-12-07 19:26:59 +01:00
Route::inertia('users', 'Users/UsersRecords')
->middleware('auth')
->name('users.index');
Route::inertia('users/{id}', 'Users/UserRecord')
->middleware('auth')
->name('users.show');
2021-12-07 19:26:59 +01:00
});
Route::get('refresh_csrf', static fn () => static function () {
session()->regenerate();
return response()->json(['token' => csrf_token()]);
})
->name('csrf.renew');