flbxcup/routes/web.php
2025-06-24 20:32:26 +02:00

26 lines
795 B
PHP

<?php
use App\Http\Controllers\CompetitionController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;
Route::get('/', function () {
// get user if it exists
$user = Auth::user();
$userTournaments = [];
if ($user) {
$userTournaments = Inertia::defer(fn() => CompetitionController::getUser($user, 1, 10));
}
return Inertia::render('Home', [
'publicTournaments' => Inertia::defer(fn() => CompetitionController::getPublics(1, 10)),
'userTournaments' => $userTournaments,
]);
})->name('home');
Route::get('dashboard', function () {
return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
require __DIR__ . '/settings.php';
require __DIR__ . '/auth.php';