Home > Enterprise >  Routing Error - how to call same route with out any error
Routing Error - how to call same route with out any error

Time:12-25

First Route

Route::get('/', [HomeController::class, 'method'])->name('home.index');

Second Route

Route::get('/{slug}', [Controller::class, 'method'])->name('view');

Third Route

Route::get('/dashboard', [HomeController::class, 'method'])->name('home');

how to call route with out any error??

CodePudding user response:

Just Change the order of routes

    Route::get('/dashboard', [HomeController::class, 'method'])->name('home');
    Route::get('/{slug}', [Controller::class, 'method'])->name('view');

CodePudding user response:

So you have to order something like this,

Route::get('/', [HomeController::class, 'method'])->name('home.index');
Route::get('/dashboard', [HomeController::class, 'method'])->name('home');
Route::get('/{slug}', [Controller::class, 'method'])->name('view');

Let me know the results.

  • Related