I want to add username before each route..
ex:
sam/productDashboard
james/productDashboard
note – Username is getting from session.
i tried like this. it doesn’t work
Route::get( session()->get(‘name’).’/productDashboard’,[ProductController::class,’ProductDashboard’])->name(‘productDashboard’);
2
Answers
This is not the way to use variable inside a route.
Do it like this:
and when you are referencing to this route with a link do it this way:
it registered on the start you can’t do in this way
You could set it like params