diff --git a/app/Http/Controllers/SubscriptionController.php b/app/Http/Controllers/SubscriptionController.php index d84e561..24d0dc9 100644 --- a/app/Http/Controllers/SubscriptionController.php +++ b/app/Http/Controllers/SubscriptionController.php @@ -104,4 +104,9 @@ public function cancel(Request $request): RedirectResponse return back()->with('success', 'Subscription canceled. Access will continue until the end of your billing period.'); } + + public function billingPortal(Request $request) + { + return $request->user()->redirectToBillingPortal(route('billing')); + } } diff --git a/resources/views/billing/index.blade.php b/resources/views/billing/index.blade.php index cf811b7..00c8900 100644 --- a/resources/views/billing/index.blade.php +++ b/resources/views/billing/index.blade.php @@ -51,6 +51,7 @@ {{ ucfirst($planner->pm_type ?? 'Card') }} •••• {{ $planner->pm_last_four }} + Update @endif diff --git a/routes/web.php b/routes/web.php index 4f4e3f9..f23fbc5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -45,5 +45,6 @@ })->name('users.index'); Route::get('/billing', [SubscriptionController::class, 'billing'])->name('billing')->middleware('saas'); + Route::get('/billing/portal', [SubscriptionController::class, 'billingPortal'])->name('billing.portal')->middleware('saas'); }); });