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ů.

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