@@ -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 () {
|
||||
|
||||
+10
-1
@@ -4,11 +4,20 @@ use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::view('/', 'welcome')->name('home');
|
||||
|
||||
Route::middleware(['auth', 'verified'])->group(function () {
|
||||
// Reachable by signed-in users who have not subscribed yet, so it is kept
|
||||
// outside the "subscribed" middleware group below.
|
||||
Route::livewire('pricing', 'pages::pricing')->name('pricing');
|
||||
|
||||
Route::middleware(['auth'])->group(function () {
|
||||
Route::livewire('subscription/confirmed', 'pages::subscription-confirmed')->name('subscription.confirmed');
|
||||
});
|
||||
|
||||
Route::middleware(['auth', 'verified', 'subscribed'])->group(function () {
|
||||
Route::livewire('dashboard', 'pages::dashboard')->name('dashboard');
|
||||
Route::livewire('todos', 'pages::todos')->name('todos');
|
||||
Route::livewire('folders', 'pages::folders')->name('folders');
|
||||
Route::livewire('admin/notes-limits', 'pages::admin.notes-limits')->name('admin.notes-limits');
|
||||
Route::livewire('admin/plan-pricing', 'pages::admin.plan-pricing')->name('admin.plan-pricing');
|
||||
});
|
||||
|
||||
require __DIR__.'/settings.php';
|
||||
|
||||
Reference in New Issue
Block a user