我的索引文件:@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']); });錯(cuò)誤文本:缺少 [路線:類別] [URI:{語(yǔ)言}/類別/{類別}] 所需的參數(shù)。(查看:/Applications/MAMP/htdocs/shop/resources/views/index.blade.php)我認(rèn)為問題是我錯(cuò)誤地插入了第二個(gè)參數(shù),請(qǐng)幫助我,預(yù)先感謝;)
1 回答

開滿天機(jī)
TA貢獻(xiàn)1786條經(jīng)驗(yàn) 獲得超13個(gè)贊
將參數(shù)作為數(shù)組傳遞。
route('category', ['language' => app()->getLocale(), 'category' => $category->name])
- 1 回答
- 0 關(guān)注
- 129 瀏覽
添加回答
舉報(bào)
0/150
提交
取消