group(function () { Route::get('/login', [WebAuthController::class, 'showLogin'])->name('login'); Route::post('/login', [WebAuthController::class, 'login']); Route::get('/register', [WebAuthController::class, 'showRegister'])->name('register'); Route::post('/register', [WebAuthController::class, 'register']); Route::get('/2fa/challenge', [WebAuthController::class, 'show2FAChallenge'])->name('2fa.challenge'); Route::post('/2fa/challenge', [WebAuthController::class, 'verify2FA']); }); // Authenticated routes Route::middleware('auth')->group(function () { Route::post('/logout', [WebAuthController::class, 'logout'])->name('logout'); // Dashboard Route::get('/', [DashboardController::class, 'index'])->name('dashboard'); Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard'); // 2FA Settings Route::get('/2fa', [TwoFactorController::class, 'show'])->name('2fa.settings'); Route::get('/2fa/enable', [TwoFactorController::class, 'enable'])->name('2fa.enable'); Route::post('/2fa/confirm', [TwoFactorController::class, 'confirm'])->name('2fa.confirm'); Route::post('/2fa/disable', [TwoFactorController::class, 'disable'])->name('2fa.disable'); Route::get('/2fa/recovery-codes', [TwoFactorController::class, 'regenerateRecoveryCodes'])->name('2fa.recovery-codes'); }); // Language switcher Route::get('/language/{locale}', function ($locale) { if (in_array($locale, ['en', 'ar'])) { session(['locale' => $locale]); app()->setLocale($locale); } return redirect()->back(); })->name('language.switch');