AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

web.php 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php
  2. use App\Http\Controllers\BillingController;
  3. use App\Http\Controllers\CartController;
  4. use App\Http\Controllers\CheckoutController;
  5. use App\Http\Controllers\OrderController;
  6. use App\Http\Controllers\ProductController;
  7. use App\Http\Controllers\StoreController;
  8. use App\Http\Controllers\StoreDesignController;
  9. use App\Http\Controllers\StoreGenerationController;
  10. use App\Http\Controllers\StorePublishController;
  11. use App\Http\Controllers\StoreSettingsController;
  12. use App\Http\Controllers\StripeWebhookController;
  13. use Illuminate\Support\Facades\Route;
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Live stores
  17. |--------------------------------------------------------------------------
  18. |
  19. | A published store has its own address: "<store name>.<domain>", such as
  20. | sambal-nenek.localhost. Shoppers need no login. These routes are listed
  21. | first so that on a store's address nothing else of the app can be opened.
  22. |
  23. */
  24. Route::domain('{storeSlug}.'.config('storefront.domain'))
  25. ->middleware('throttle:240,1')
  26. ->name('storefront.')
  27. ->group(function () {
  28. Route::get('/', [StoreDesignController::class, 'preview'])->name('home');
  29. Route::get('shop', [StoreDesignController::class, 'shop'])->name('shop');
  30. Route::get('products/{productSlug}', [StoreDesignController::class, 'product'])->name('product');
  31. Route::get('cart', [CartController::class, 'show'])->name('cart');
  32. Route::post('cart/items', [CartController::class, 'add'])->name('cart.add');
  33. Route::patch('cart/items/{product}', [CartController::class, 'update'])->name('cart.update')->whereNumber('product');
  34. Route::delete('cart/items/{product}', [CartController::class, 'remove'])->name('cart.remove')->whereNumber('product');
  35. Route::get('checkout', [CheckoutController::class, 'show'])->name('checkout');
  36. Route::post('checkout', [CheckoutController::class, 'store'])->middleware('throttle:20,1')->name('checkout.store');
  37. Route::get('orders/{publicId}', [CheckoutController::class, 'order'])->name('order');
  38. // Pages the merchant added, such as /about.
  39. Route::get('{pageId}', [StoreDesignController::class, 'page'])->name('page')->where('pageId', '[a-z][a-z0-9-]*');
  40. // Anything else on a store's address does not exist. This hides the dashboard and login pages there.
  41. Route::any('{any}', fn () => abort(404))->where('any', '.*')->name('missing');
  42. });
  43. Route::inertia('/', 'welcome')->name('home');
  44. // Called by Stripe, not by a browser, so it has no login. Each message is checked with a signing secret.
  45. Route::post('stripe/webhook', StripeWebhookController::class)->name('stripe.webhook');
  46. Route::middleware(['auth', 'verified'])->group(function () {
  47. Route::get('dashboard', [StoreController::class, 'index'])->name('dashboard');
  48. Route::get('billing', [BillingController::class, 'index'])->name('billing');
  49. Route::post('billing/subscribe', [BillingController::class, 'subscribe'])->name('billing.subscribe');
  50. Route::post('billing/cancel', [BillingController::class, 'cancel'])->name('billing.cancel');
  51. Route::post('billing/resume', [BillingController::class, 'resume'])->name('billing.resume');
  52. Route::get('stores/create', [StoreController::class, 'create'])->name('stores.create');
  53. Route::post('stores', [StoreController::class, 'store'])->name('stores.store');
  54. Route::get('stores/{slug}', [StoreController::class, 'show'])->name('stores.show');
  55. Route::get('stores/{slug}/preview', [StoreDesignController::class, 'preview'])->name('stores.preview');
  56. Route::get('stores/{slug}/preview/shop', [StoreDesignController::class, 'shop'])->name('stores.preview.shop');
  57. Route::get('stores/{slug}/preview/products/{productSlug}', [StoreDesignController::class, 'product'])->name('stores.preview.product');
  58. Route::get('stores/{slug}/preview/cart', [CartController::class, 'show'])->name('stores.preview.cart');
  59. Route::post('stores/{slug}/preview/cart/items', [CartController::class, 'add'])->name('stores.preview.cart.add');
  60. Route::patch('stores/{slug}/preview/cart/items/{product}', [CartController::class, 'update'])->name('stores.preview.cart.update')->whereNumber('product');
  61. Route::delete('stores/{slug}/preview/cart/items/{product}', [CartController::class, 'remove'])->name('stores.preview.cart.remove')->whereNumber('product');
  62. Route::get('stores/{slug}/preview/checkout', [CheckoutController::class, 'show'])->name('stores.preview.checkout');
  63. Route::post('stores/{slug}/preview/checkout', [CheckoutController::class, 'store'])->name('stores.preview.checkout.store');
  64. Route::get('stores/{slug}/preview/orders/{publicId}', [CheckoutController::class, 'order'])->name('stores.preview.order');
  65. // Pages the merchant added, such as /about. Listed after the store's own pages so those win.
  66. Route::get('stores/{slug}/preview/{pageId}', [StoreDesignController::class, 'page'])->name('stores.preview.page')->where('pageId', '[a-z][a-z0-9-]*');
  67. Route::get('stores/{slug}/orders', [OrderController::class, 'index'])->name('stores.orders.index');
  68. Route::get('stores/{slug}/orders/{order}', [OrderController::class, 'show'])->name('stores.orders.show')->whereNumber('order');
  69. Route::post('stores/{slug}/orders/{order}/ship', [OrderController::class, 'ship'])->name('stores.orders.ship')->whereNumber('order');
  70. Route::get('stores/{slug}/products', [ProductController::class, 'index'])->name('stores.products.index');
  71. Route::get('stores/{slug}/products/create', [ProductController::class, 'create'])->name('stores.products.create');
  72. Route::post('stores/{slug}/products', [ProductController::class, 'store'])->name('stores.products.store');
  73. Route::get('stores/{slug}/products/{product}/edit', [ProductController::class, 'edit'])->name('stores.products.edit')->whereNumber('product');
  74. // Saving uses POST, not PUT, because browsers can only upload files with POST.
  75. Route::post('stores/{slug}/products/{product}', [ProductController::class, 'update'])->name('stores.products.update')->whereNumber('product');
  76. Route::delete('stores/{slug}/products/{product}', [ProductController::class, 'destroy'])->name('stores.products.destroy')->whereNumber('product');
  77. Route::delete('stores/{slug}/products/{product}/images/{image}', [ProductController::class, 'destroyImage'])->name('stores.products.images.destroy')->whereNumber(['product', 'image']);
  78. Route::get('stores/{slug}/settings', [StoreSettingsController::class, 'edit'])->name('stores.settings');
  79. Route::put('stores/{slug}/settings', [StoreSettingsController::class, 'update'])->name('stores.settings.update');
  80. Route::post('stores/{slug}/publish', [StorePublishController::class, 'publish'])->name('stores.publish');
  81. Route::post('stores/{slug}/unpublish', [StorePublishController::class, 'unpublish'])->name('stores.unpublish');
  82. Route::post('stores/{slug}/generate', [StoreGenerationController::class, 'generate'])->name('stores.generate');
  83. Route::post('stores/{slug}/edits', [StoreGenerationController::class, 'edit'])->name('stores.edits');
  84. });
  85. require __DIR__.'/settings.php';