Add payment methods management page
List Stripe payment methods with set-default and remove actions. Includes delete confirmation dialog, breadcrumb navigation, and sidebar nav entry. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,35 @@ class BillingController extends Controller
|
||||
return back()->with('success', 'Default payment method updated.');
|
||||
}
|
||||
|
||||
public function paymentMethods(Request $request): Response
|
||||
{
|
||||
$user = $request->user();
|
||||
$paymentMethods = [];
|
||||
$defaultPaymentMethod = null;
|
||||
|
||||
if ($user->hasStripeId()) {
|
||||
$methods = $user->paymentMethods();
|
||||
$defaultPm = $user->defaultPaymentMethod();
|
||||
$defaultPaymentMethod = $defaultPm?->id;
|
||||
|
||||
foreach ($methods as $method) {
|
||||
$paymentMethods[] = [
|
||||
'id' => $method->id,
|
||||
'brand' => $method->card->brand ?? 'unknown',
|
||||
'last_four' => $method->card->last_four ?? '****',
|
||||
'exp_month' => $method->card->exp_month,
|
||||
'exp_year' => $method->card->exp_year,
|
||||
'is_default' => $method->id === $defaultPaymentMethod,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return Inertia::render('Billing/PaymentMethods', [
|
||||
'paymentMethods' => $paymentMethods,
|
||||
'defaultPaymentMethod' => $defaultPaymentMethod,
|
||||
]);
|
||||
}
|
||||
|
||||
public function invoices(Request $request): Response
|
||||
{
|
||||
$invoices = $request->user()
|
||||
|
||||
Reference in New Issue
Block a user