我有问题,但没有找到解决方案。它显示以下失败:Facade\Ignition\Exceptions\ViewException 缺少 [Route: settings.networks.update] [URI: settings/networks/{network}] 所需的参数。(视图:C:\xampp\htdocs\patom\layout\resources\views\settings\networks\edit.blade.php) http://localhost:8000/settings/networks/5/edit我的控制器:/** * Show the form for editing the specified resource. * * @param \App\Network $network * @return \Illuminate\Http\Response */public function edit($id){ $network = Network::find($id); return view('settings.networks.edit', compact('network'));}我的指数:|@foreach($networks as $network) <tr> <td>{{ $network->id }}</td> <td>{{ $network->name }}</td> <td><div class="btn-toolbar pull-right"> <a href="{{ route('settings.networks.edit', $network->id) }}"><button type="button" class="btn btn-success mr-3">Edit</button></a> <form action="{{ route('settings.networks.destroy', $network->id) }}" method="POST"> @csrf {{ method_field('DELETE') }} <button type="submit" class="btn btn-danger mr-3">Delete</button> </form> </div> </td> </tr> @endforeach我的路线:Route::namespace('Settings')->prefix('settings')->name('settings.')->group(function(){Route::resource('/networks', 'NetworksController', ['except' => ['show']]);});
1 回答
慕森王
TA贡献1777条经验 获得超3个赞
当您将路由放在视图文件中时,您仍然需要包含用于路由生成的模型。
您的视图中有一条路线,但缺少网络模型。
{{ route('settings.networks.update') }}
您已经包含网络,因此添加它应该很简单。
{{ route('settings.networks.update', ['network' => $network]) }}
- 1 回答
- 0 关注
- 69 浏览
添加回答
举报
0/150
提交
取消