我的索引文件:@foreach ($categories as $category) <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a href="{{ route('category', app()->getLocale(), $category->name) }}">{{ $category->name }}</a></h4> </div> </div>@endforeach我的路线文件:Route::prefix('/{language}')->group(function () {Route::get('/', ['uses' => 'IndexController@home', 'as' => 'home']);Route::post('/', ['uses' => 'IndexController@price', 'as' => 'price']);Route::get('contact', ['uses' => 'ContactController@show', 'as' => 'contact']);Route::post('contact', ['uses' => 'ContactController@send', 'as' => 'contact-send']);Route::get('/category/{category}', ['uses' => 'CategoryController@show', 'as' => 'category']); });错误文本:缺少 [路线:类别] [URI:{语言}/类别/{类别}] 所需的参数。(查看:/Applications/MAMP/htdocs/shop/resources/views/index.blade.php)我认为问题是我错误地插入了第二个参数,请帮助我,预先感谢;)
1 回答
开满天机
TA贡献1786条经验 获得超13个赞
将参数作为数组传递。
route('category', ['language' => app()->getLocale(), 'category' => $category->name])
- 1 回答
- 0 关注
- 96 浏览
添加回答
举报
0/150
提交
取消