web.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. use Illuminate\Support\Facades\Route;
  3. use App\Http\Controllers\HomeController;
  4. use App\Http\Controllers\ProductController;
  5. use App\Http\Controllers\PageController;
  6. use App\Http\Controllers\ContactController;
  7. use App\Http\Controllers\VideoController;
  8. use App\Http\Controllers\DemoController;
  9. use App\Http\Controllers\SitemapController;
  10. use App\Http\Controllers\CollectionController;
  11. /*
  12. |--------------------------------------------------------------------------
  13. | Web Routes
  14. |--------------------------------------------------------------------------
  15. |
  16. | Here is where you can register web routes for your application. These
  17. | routes are loaded by the RouteServiceProvider and all of them will
  18. | be assigned to the "web" middleware group. Make something great!
  19. |
  20. */
  21. Route::get('/demo', [DemoController::class, 'index'])->name('demo');
  22. // 主页
  23. Route::get('/', [HomeController::class, 'index'])->name('home');
  24. // 产品路由
  25. Route::prefix('products')->group(function () {
  26. Route::get('/', [ProductController::class, 'index'])->name('products.index');
  27. Route::get('/{id}', [ProductController::class, 'detail'])->name('products.detail');
  28. Route::get('/categories/{categoryId}', [ProductController::class, 'category'])->name('products.category');
  29. });
  30. // 视频路由
  31. Route::prefix('videos')->group(function () {
  32. Route::get('/', [VideoController::class, 'index'])->name('videos.index');
  33. Route::get('/{id}', [VideoController::class, 'show'])->name('videos.show');
  34. Route::get('/categories/{categoryId}', [VideoController::class, 'category'])->name('videos.category');
  35. });
  36. // 文章路由
  37. Route::prefix('pages')->group(function () {
  38. Route::get('/', [PageController::class, 'list'])->name('page.list'); // 页面列表页
  39. Route::get('/{slug}', [PageController::class, 'detail'])->name('page.detail'); // 页面详情页
  40. });
  41. ////专题路由,于用文章
  42. //Route::get('/collections/{slug}', [CollectionController::class, 'show'])->name('collections.show');
  43. //
  44. // 询盘路由
  45. Route::prefix('contact')->group(function () {
  46. Route::get('/', [ContactController::class, 'create'])->name('contact.create');
  47. Route::post('/', [ContactController::class, 'store'])->name('contact.store');
  48. });
  49. Route::prefix('collections')->group(function () {
  50. Route::get('/{slug}', [CollectionController::class, 'detail'])->name('collection.detail');
  51. });
  52. // Sitemap 路由
  53. Route::get('/sitemap.xml', [SitemapController::class, 'index'])->name('sitemap.index');