我定义了以下路由:
Route::get('/tours/{country_identifier}', ['as' => 'country', 'uses' => 'CountryController@index']);
现在我想使用类似的方式链接到这个命名路由
route('country')
填入 {country_identifier} 的参数,例如'/tours/加拿大'。
我怎样才能做到这一点?
最佳答案
您可以将参数作为第二个参数数组传递:
route('country', ['country_identifier' => $someValue]);
你可以看看documentation , 那里有很多有用的例子:)
关于php - Laravel:(如何)可以使用参数链接到命名路由?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30503989/