group(function (): void { Route::post('register', [AuthController::class, 'register']); Route::post('login', [AuthController::class, 'login']); // Route::get('{provider}/redirect', [ProviderRedirectController::class, 'redirect']); // Route::get('{provider}/callback', [ProviderCallbackController::class, 'callback']); }); // List hunts //Ensure is Admin Route::middleware(['auth:sanctum', EnsureUserIsAdmin::class])->group(function () { Route::post('users/{user}/delete', [UsersController::class, 'softDeleteById'])->withTrashed(); }); // Ensure is Orga Route::middleware(['auth:sanctum', EnsureUserIsOrga::class])->group(function () { Route::post('hunts', [HuntsController::class, 'store']); Route::post('hunts/{hunt}/steps', [HuntStepsController::class, 'store']); Route::match(['put', 'patch'], 'hunts/{hunt}', [HuntsController::class, 'update']); Route::delete('hunts/{hunt}', [HuntsController::class, 'destroy']); }); // Auth middleware Route::middleware('auth:sanctum')->group(function (): void { Route::get('hunts', [HuntsController::class, 'index']); Route::get('hunts/{hunt}', [HuntsController::class, 'show']); //Auth Route::post('auth/delete', [AuthController::class, 'softDelete']); // User Route::get('users/leaderboard', [UsersController::class, 'leaderboard']); Route::put('users/update/username', [UsersController::class, 'updateUsername']); Route::put('users/update/password', [UsersController::class, 'updatePassword']); Route::get('users/{user}', [UsersController::class, 'show']); Route::post('users/{user}/avatar', [UsersController::class, 'updateAvatar']); Route::post('hunts/{hunt}/participate', [HuntsController::class, 'participate']); Route::delete('hunts/{hunt}/participate', [HuntsController::class, 'unparticipate']); Route::post('hunts/{hunt}/steps/{step}/validate', [HuntStepsController::class, 'validateStep']); Route::get('auth/me', [AuthController::class, 'me']); Route::post('auth/logout', [AuthController::class, 'logout']); });