Browse Source

产品分类路由 路由修改

moshaorui 2 days ago
parent
commit
efc179e49b
1 changed files with 5 additions and 0 deletions
  1. 5 0
      routes/web.php

+ 5 - 0
routes/web.php

@@ -75,6 +75,11 @@ Route::prefix('products')->group(function () {
     Route::get('/categories/{categoryId}', [ProductController::class, 'category'])->name('products.category');
 });
 
+// 产品分类路由
+Route::get('/categories-{slug}', [ProductController::class, 'category'])
+    ->name('products.category.slug')
+    ->where('slug', '[a-z0-9-]+'); // 限制 slug 格式
+
 // 视频路由
 Route::prefix('videos')->group(function () {
     Route::get('/', [VideoController::class, 'index'])->name('videos.index');