简体   繁体   English

laravel 5条路线在哪里

[英]laravel 5 routes where in group

I wanna create url like this 我想这样创建网址

http://example.com/url1/product/blabla http://example.com/url2/product/aiueo 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? 还是应该在{page}前缀内的每个方法中使用where()

You can use it with group like this: 您可以将其与以下组一起使用:

Route::group([
    'as' => 'the_url',
    'prefix' => '{page}', 
    'where' => [
        'page' => 'url1|url2'
    ],
], function () {
    // Group routes
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM