AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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