web.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. /*
  10. |--------------------------------------------------------------------------
  11. | Web Routes
  12. |--------------------------------------------------------------------------
  13. |
  14. | Here is where you can register web routes for your application. These
  15. | routes are loaded by the RouteServiceProvider and all of them will
  16. | be assigned to the "web" middleware group. Make something great!
  17. |
  18. */
  19. Route::get('/demo', [DemoController::class, 'index'])->name('demo');
  20. // 主页
  21. Route::get('/', [HomeController::class, 'index'])->name('home');
  22. // 产品路由
  23. Route::prefix('products')->group(function () {
  24. Route::get('/', [ProductController::class, 'index'])->name('products.index');
  25. Route::get('/{id}', [ProductController::class, 'show'])->name('products.show');
  26. });
  27. // 视频路由
  28. Route::prefix('videos')->group(function () {
  29. Route::get('/', [VideoController::class, 'index'])->name('videos.index');
  30. Route::get('/{id}', [VideoController::class, 'show'])->name('videos.show');
  31. });
  32. // 文章路由
  33. Route::prefix('page')->group(function () {
  34. Route::get('/', [PageController::class, 'list'])->name('page.list'); // 页面列表页
  35. Route::get('/{slug}', [PageController::class, 'detail'])->name('page.detail'); // 页面详情页
  36. });
  37. // 询盘路由
  38. Route::prefix('contact')->group(function () {
  39. Route::get('/', [ContactController::class, 'create'])->name('contact.create');
  40. Route::post('/', [ContactController::class, 'store'])->name('contact.store');
  41. });