.", such as | sambal-nenek.localhost. Shoppers need no login. These routes are listed | first so that on a store's address nothing else of the app can be opened. | */ Route::domain('{storeSlug}.'.config('storefront.domain')) ->middleware('throttle:240,1') ->name('storefront.') ->group(function () { Route::get('/', [StoreDesignController::class, 'preview'])->name('home'); Route::get('shop', [StoreDesignController::class, 'shop'])->name('shop'); Route::get('products/{productSlug}', [StoreDesignController::class, 'product'])->name('product'); Route::get('cart', [CartController::class, 'show'])->name('cart'); Route::post('cart/items', [CartController::class, 'add'])->name('cart.add'); Route::patch('cart/items/{product}', [CartController::class, 'update'])->name('cart.update')->whereNumber('product'); Route::delete('cart/items/{product}', [CartController::class, 'remove'])->name('cart.remove')->whereNumber('product'); Route::get('checkout', [CheckoutController::class, 'show'])->name('checkout'); Route::post('checkout', [CheckoutController::class, 'store'])->middleware('throttle:20,1')->name('checkout.store'); Route::get('orders/{publicId}', [CheckoutController::class, 'order'])->name('order'); // Pages the merchant added, such as /about. Route::get('{pageId}', [StoreDesignController::class, 'page'])->name('page')->where('pageId', '[a-z][a-z0-9-]*'); // Anything else on a store's address does not exist. This hides the dashboard and login pages there. Route::any('{any}', fn () => abort(404))->where('any', '.*')->name('missing'); }); Route::inertia('/', 'welcome')->name('home'); // Called by Stripe, not by a browser, so it has no login. Each message is checked with a signing secret. Route::post('stripe/webhook', StripeWebhookController::class)->name('stripe.webhook'); Route::middleware(['auth', 'verified'])->group(function () { Route::get('dashboard', [StoreController::class, 'index'])->name('dashboard'); Route::get('stores/create', [StoreController::class, 'create'])->name('stores.create'); Route::post('stores', [StoreController::class, 'store'])->name('stores.store'); Route::get('stores/{slug}', [StoreController::class, 'show'])->name('stores.show'); Route::get('stores/{slug}/preview', [StoreDesignController::class, 'preview'])->name('stores.preview'); Route::get('stores/{slug}/preview/shop', [StoreDesignController::class, 'shop'])->name('stores.preview.shop'); Route::get('stores/{slug}/preview/products/{productSlug}', [StoreDesignController::class, 'product'])->name('stores.preview.product'); Route::get('stores/{slug}/preview/cart', [CartController::class, 'show'])->name('stores.preview.cart'); Route::post('stores/{slug}/preview/cart/items', [CartController::class, 'add'])->name('stores.preview.cart.add'); Route::patch('stores/{slug}/preview/cart/items/{product}', [CartController::class, 'update'])->name('stores.preview.cart.update')->whereNumber('product'); Route::delete('stores/{slug}/preview/cart/items/{product}', [CartController::class, 'remove'])->name('stores.preview.cart.remove')->whereNumber('product'); Route::get('stores/{slug}/preview/checkout', [CheckoutController::class, 'show'])->name('stores.preview.checkout'); Route::post('stores/{slug}/preview/checkout', [CheckoutController::class, 'store'])->name('stores.preview.checkout.store'); Route::get('stores/{slug}/preview/orders/{publicId}', [CheckoutController::class, 'order'])->name('stores.preview.order'); // Pages the merchant added, such as /about. Listed after the store's own pages so those win. Route::get('stores/{slug}/preview/{pageId}', [StoreDesignController::class, 'page'])->name('stores.preview.page')->where('pageId', '[a-z][a-z0-9-]*'); Route::get('stores/{slug}/orders', [OrderController::class, 'index'])->name('stores.orders.index'); Route::get('stores/{slug}/orders/{order}', [OrderController::class, 'show'])->name('stores.orders.show')->whereNumber('order'); Route::get('stores/{slug}/products', [ProductController::class, 'index'])->name('stores.products.index'); Route::get('stores/{slug}/products/create', [ProductController::class, 'create'])->name('stores.products.create'); Route::post('stores/{slug}/products', [ProductController::class, 'store'])->name('stores.products.store'); Route::get('stores/{slug}/products/{product}/edit', [ProductController::class, 'edit'])->name('stores.products.edit')->whereNumber('product'); // Saving uses POST, not PUT, because browsers can only upload files with POST. Route::post('stores/{slug}/products/{product}', [ProductController::class, 'update'])->name('stores.products.update')->whereNumber('product'); Route::delete('stores/{slug}/products/{product}', [ProductController::class, 'destroy'])->name('stores.products.destroy')->whereNumber('product'); Route::delete('stores/{slug}/products/{product}/images/{image}', [ProductController::class, 'destroyImage'])->name('stores.products.images.destroy')->whereNumber(['product', 'image']); Route::post('stores/{slug}/publish', [StorePublishController::class, 'publish'])->name('stores.publish'); Route::post('stores/{slug}/unpublish', [StorePublishController::class, 'unpublish'])->name('stores.unpublish'); Route::post('stores/{slug}/generate', [StoreGenerationController::class, 'generate'])->name('stores.generate'); Route::post('stores/{slug}/edits', [StoreGenerationController::class, 'edit'])->name('stores.edits'); }); require __DIR__.'/settings.php';