【发布时间】:2017-04-18 11:39:44
【问题描述】:
当参数为空或 null 时,我需要使用 laravel 路由将默认值放在 url 中。我认为是这样的(显然没有找到),但你明白我的想法。
Route::get('/filtro/{event_type?}-en-{location?}/{caption?}', [
'uses' => 'ProviderController@filter',
'as' => 'site_filter_path'
])->defaults([
'event_type' => 'todos',
'location' => 'argentina'
]);
所以当参数为空时,url 可能是 mysite.com/filtro/todos-en-argentina/
【问题讨论】: