I wanna create url like this
http://example.com/url1/product/blabla http://example.com/url2/product/aiueo
I can't achieve with this
Route::prefix('{page}')->name('the_url')->group(function () {
Route::get('/', 'HomeController@page')
->name('index');
})->where('page', '(url1|url2)');
Or should I use the where()
in every method inside the {page}
prefix?
You can use it with group like this:
Route::group([
'as' => 'the_url',
'prefix' => '{page}',
'where' => [
'page' => 'url1|url2'
],
], function () {
// Group routes
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.