Files
3dealer/routes/checkout.php
T
2026-09-23 17:53:23 +03:00

68 lines
2.8 KiB
PHP

<?php
use App\Http\Controllers\Checkout\CartController;
use App\Http\Controllers\Checkout\CheckoutController;
use App\Http\Controllers\Checkout\CustomFieldFileController;
use Illuminate\Support\Facades\Route;
/*
* Cart + checkout module routes.
*
* The {locale} prefix and `locale` middleware mirror the 3dealer host's
* localization convention (CLAUDE.md » Localization). When this module moves to
* boboko-core the route definitions travel with it, but each host wraps them in
* whatever prefix/middleware it uses. Every action still declares $locale as its
* first parameter regardless, per the ControllerDispatcher positional-args
* gotcha documented in CLAUDE.md.
*
* Loaded from CheckoutModuleServiceProvider inside the `web` middleware group.
*/
Route::prefix('{locale}')
->middleware('locale')
->group(function () {
// No standalone cart page — the drawer (checkout::drawer) is the cart.
Route::get('checkout', [CheckoutController::class, 'show'])
->name('checkout.show');
Route::post('checkout/address', [CheckoutController::class, 'saveAddress'])
->name('checkout.address.save');
Route::post('checkout/shipping-option', [CheckoutController::class, 'selectShippingOption'])
->name('checkout.shipping-option.select');
Route::post('checkout/payment-method', [CheckoutController::class, 'selectPaymentMethod'])
->name('checkout.payment-method.select');
Route::post('checkout/place-order', [CheckoutController::class, 'placeOrder'])
->name('checkout.place-order');
Route::get('checkout/order-status', [CheckoutController::class, 'orderStatus'])
->name('checkout.order-status');
Route::get('checkout/confirmation', [CheckoutController::class, 'confirmation'])
->name('checkout.confirmation');
Route::post('cart/lines', [CartController::class, 'add'])
->name('checkout.cart.add');
Route::patch('cart/lines/{line}', [CartController::class, 'updateLine'])
->whereNumber('line')
->name('checkout.cart.update');
Route::delete('cart/lines/{line}', [CartController::class, 'remove'])
->whereNumber('line')
->name('checkout.cart.remove');
// A line's custom-field file (e.g. the shopper's photo) — signed,
// temporary URLs only; see CustomFieldFileController.
Route::get('cart/custom-field-file', CustomFieldFileController::class)
->middleware('signed')
->name('checkout.custom-field-file');
Route::post('cart/coupon', [CartController::class, 'applyCoupon'])
->name('checkout.cart.coupon.apply');
Route::delete('cart/coupon', [CartController::class, 'removeCoupon'])
->name('checkout.cart.coupon.remove');
});