generated from boboko/starter
70 lines
2.9 KiB
PHP
70 lines
2.9 KiB
PHP
<?php
|
|
|
|
use App\Http\Controllers\CategoryController;
|
|
use App\Http\Controllers\ContactController;
|
|
use App\Http\Controllers\CustomFieldUploadController;
|
|
use App\Http\Controllers\HomeController;
|
|
use App\Http\Controllers\LegalPageController;
|
|
use App\Http\Controllers\ProductController;
|
|
use App\Http\Controllers\SearchController;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
// Bare `/` has no {locale} segment to prefix-match against, so it's declared outside
|
|
// the group below purely to give `locale` middleware a route to run on — the group's
|
|
// `Route::prefix('{locale}')` requires a non-empty first segment, so `/` would
|
|
// otherwise 404 before the middleware (which already redirects an empty/unrecognized
|
|
// locale segment to the resolved default) ever gets a chance to run. Middleware runs
|
|
// before controller parameter binding, so this never actually reaches
|
|
// HomeController::index()'s required $locale argument — the middleware always
|
|
// redirects a request with no matching locale segment first.
|
|
Route::get('/', [HomeController::class, 'index'])->middleware('locale');
|
|
|
|
Route::prefix('{locale}')
|
|
->middleware('locale')
|
|
->group(function () {
|
|
Route::get('/', [HomeController::class, 'index'])->name('home');
|
|
|
|
Route::get('/products', [ProductController::class, 'index'])->name('products');
|
|
|
|
Route::get('/products/{id}', [ProductController::class, 'show'])->name(
|
|
'product.show',
|
|
);
|
|
|
|
Route::get('/products-stock-check', [ProductController::class, 'checkStock'])->name(
|
|
'product.stock-check',
|
|
);
|
|
|
|
// Photo for a product custom field, uploaded as soon as it's picked —
|
|
// see CustomFieldUploadController. Throttled: it writes to disk and
|
|
// needs no cart/session to call.
|
|
Route::post('/custom-field-uploads', [CustomFieldUploadController::class, 'store'])
|
|
->middleware('throttle:20,1')
|
|
->name('custom-field-upload.store');
|
|
|
|
Route::post('/products/{product}/reviews', [ProductController::class, 'storeReview'])->name(
|
|
'product.reviews.store',
|
|
);
|
|
|
|
Route::get('/category/{id}', [CategoryController::class, 'show'])->name(
|
|
'category.show',
|
|
);
|
|
|
|
Route::get('/search', [SearchController::class, 'show'])->name('search');
|
|
|
|
Route::get('/contact', [ContactController::class, 'index'])->name('contact');
|
|
|
|
Route::get('/terms-and-conditions', [LegalPageController::class, 'terms'])->name(
|
|
'legal.terms',
|
|
);
|
|
Route::get('/shipping-returns', [LegalPageController::class, 'shippingReturns'])->name(
|
|
'legal.shipping-returns',
|
|
);
|
|
Route::get('/privacy-policy', [LegalPageController::class, 'privacy'])->name(
|
|
'legal.privacy',
|
|
);
|
|
Route::get('/cookies-policy', [LegalPageController::class, 'cookies'])->name(
|
|
'legal.cookies',
|
|
);
|
|
|
|
});
|