added cashier subscription, subscription plans
This commit is contained in:
@@ -47,6 +47,33 @@ Route::middleware(['auth', 'verified'])->group(function () {
|
||||
Route::get('dashboard/bulk-email-generator', Dashboard::class)->name('dashboard.bulk');
|
||||
Route::get('dashboard/compose-email', Dashboard::class)->name('dashboard.compose');
|
||||
|
||||
// Checkout Routes
|
||||
Route::get('checkout/{plan}', function ($pricing_id) {
|
||||
$plans = config('app.plans');
|
||||
$pricingData = [];
|
||||
foreach ($plans as $plan) {
|
||||
$pricingData[] = $plan['pricing_id'];
|
||||
}
|
||||
|
||||
if (in_array($pricing_id, $pricingData)) {
|
||||
return auth()->user()
|
||||
->newSubscription('default', $pricing_id)
|
||||
->allowPromotionCodes()
|
||||
->checkout([
|
||||
'success_url' => route('checkout.success'),
|
||||
'cancel_url' => route('checkout.cancel'),
|
||||
]);
|
||||
|
||||
}
|
||||
abort(404);
|
||||
})->name('checkout');
|
||||
|
||||
Route::get('dashboard/success', [Dashboard::class, 'paymentStatus'])->name('checkout.success')->defaults('status', 'success');
|
||||
Route::get('dashboard/cancel', [Dashboard::class, 'paymentStatus'])->name('checkout.cancel')->defaults('status', 'cancel');
|
||||
|
||||
Route::get('dashboard/billing', function () {
|
||||
return auth()->user()->redirectToBillingPortal(route('dashboard'));
|
||||
})->name('billing');
|
||||
});
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
|
||||
Reference in New Issue
Block a user