1 Commits

Author SHA1 Message Date
Ovidiu U
da0db012a0 Drop duplicate 'logout' route name so route:cache works
The SPA's GET /logout and Fortify's POST /logout both carried the name
'logout', which is fine at runtime (distinct verbs, same URL) but breaks
route:cache (names must be unique for serialization). The Blade auth forms
target route('logout') = Fortify's POST route, so the custom GET route — used
by the SPA via a literal /logout URL — no longer needs the name.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-11 13:34:32 +01:00

View File

@@ -8,14 +8,17 @@ use Illuminate\Support\Facades\Route;
// Named dashboard route so route('dashboard') resolves; Vue Router handles rendering // Named dashboard route so route('dashboard') resolves; Vue Router handles rendering
Route::get('/dashboard', fn () => view('app'))->middleware(['auth', 'verified'])->name('dashboard'); Route::get('/dashboard', fn () => view('app'))->middleware(['auth', 'verified'])->name('dashboard');
// Server-side logout — handles hard navigation to /logout // Server-side logout for the SPA's hard navigation (GET /logout).
// Intentionally unnamed: the `logout` route name belongs to Fortify's POST /logout,
// which the Blade auth forms target via route('logout'). Both can share the /logout
// URL (different verbs), but two routes cannot share a name — that breaks route:cache.
Route::get('/logout', function (Request $request) { Route::get('/logout', function (Request $request) {
Auth::logout(); Auth::logout();
$request->session()->invalidate(); $request->session()->invalidate();
$request->session()->regenerateToken(); $request->session()->regenerateToken();
return redirect('/'); return redirect('/');
})->middleware('auth')->name('logout'); })->middleware('auth');
Route::middleware(['auth'])->prefix('billing')->name('billing.')->group(function () { Route::middleware(['auth'])->prefix('billing')->name('billing.')->group(function () {
Route::get('/checkout/{tier}/{cadence}', [BillingController::class, 'checkout'])->name('checkout'); Route::get('/checkout/{tier}/{cadence}', [BillingController::class, 'checkout'])->name('checkout');