group(function () { Route::redirect('settings', 'settings/profile'); Route::livewire('settings/profile', 'pages::settings.profile')->name('profile.edit'); // Deliberately outside the "subscribed" middleware group so that a lapsed // subscriber can still manage their plan, or subscribe again. Route::livewire('settings/billing', 'pages::settings.billing')->name('billing.edit'); Route::post('settings/billing/portal', function (): RedirectResponse { $organization = request()->user()?->currentOrganization()->first(); // The Stripe customer portal only exists once an organization has been // created as a Stripe customer, which happens on the first checkout. if ($organization === null || ! $organization->hasStripeId()) { return redirect()->route('billing.edit'); } return redirect()->to($organization->billingPortalUrl(route('billing.edit'))); })->name('billing.portal'); }); Route::middleware(['auth', 'verified'])->group(function () { Route::livewire('settings/appearance', 'pages::settings.appearance')->name('appearance.edit'); Route::livewire('settings/security', 'pages::settings.security') ->middleware([ 'password.confirm', ]) ->name('security.edit'); }); Route::get('.well-known/passkey-endpoints', function () { return response()->json([ 'enroll' => route('security.edit'), 'manage' => route('security.edit'), ]); })->name('well-known.passkeys');