0
我想添加控件鏈接到我的表中的每個值。我創建了資源控制器,現在想在我的視圖中調用一些操作(更新,顯示,刪除)。 我做了這樣的:添加控件鏈接查看
@foreach($teams as $team)
<tr>
<td>{{$team->name}}</td>
<td>{{$team->score}}</td>
<td>
<a class="btn btn-info" href="{{ route("teams.show/{$team}") }} ">Show</a>
<a class="btn btn-danger" href="{{ route("teams.destroy/{$team}") }}">Delete</a>
<a class="btn btn-info" href="{{ route("teams.edit/{$team}") }}">Update</a>
</td>
</tr>
@endforeach
,並在我的航線網絡文件:
Route::resource('teams','TeamController');
但現在我有錯誤,當試圖訪問索引視圖:
(2/2) ErrorException
Route [teams.destroy/{"id":8,"name":"Zorya","score":15}] not defined. (View: H:\xampp\htdocs\hockeyapp\resources\views\teams\index.blade.php)
'{{route(「teams.show/{$ team-> id}」)}}'我相信你應該回顯團隊ID?不是整個'$ team'對象。 – Spectarion
在laravel 5資源控制器創建與函數(銷燬,顯示,更新)與參數團隊$團隊,我想處理它。 – Rosti
如果你這麼說。但我確定這不是它的工作原理。 – Spectarion