@@ -1,11 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::middleware(['auth'])->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 () {
|
||||
|
||||
Reference in New Issue
Block a user