Answer the question
In order to leave comments, you need to log in
How to work with static routes and variables in Laravel?
I would also add the "curvature" tag, but maybe I won't miss it)
Hello everyone.
I understand Laravel 8 and there was a small problem.
Web.php has several routes that open different views at different addresses. There are requests that have a static address, for example:
Route::get('/basket/add', '[email protected]')->name('basket');
Route::get('/{category}/{product?}', '[email protected]')->name('product');
localhost:8000/basket/add
, it opens a view that should open when requested localhost:8000/{category}/{product?}
Route::get('/{category}', '[email protected]')->name('category');
Route::get('/place', '[email protected]')->name('basket-place');
Route::get('/{category}', '[email protected]')->name('category');
Route::get('/categories', '[email protected]')->name('categories');
Answer the question
In order to leave comments, you need to log in
"Static" must be declared after "dynamic".
But in theory it should take only those addresses that are in the databaseThe router knows nothing about the contents of your database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question