mardi 26 avril 2022

Same route different controllers

im trying to use same route but different controllers, but not getting a clean and good solution for it, for example my intention is:

Domain.com/category-slug

Domain.com/article-slug

But each one have different controller, using the same structure routes doesnt go to the intended controller, above leave my web.php

Route::get('/', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
Route::get('/{category}', [App\Http\Controllers\QuestionController::class, 'index'])->name('category.list');

Route::get('/{slug}', [App\Http\Controllers\QuestionController::class, 'show'])->name('questions.show');

Does someone got the same situation and how it handle it?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire