我的路线有问题:
缺少[Route: panitia]所需的参数。[URI: admin/panitia/{panitium}][缺少参数:panitium]。(观点:C:UsersMbenDarisDocumentsProjectbettaresourcesviewsadminpanitia edit.blade.php)
This my controller:
public function edit(Panitia $panitias)
{
return view('admin.panitia.edit', compact('panitias'));
}
这是我的代码edit.blade.php:
<form action="{{ route('panitia.update', $panitias->id) }}" method="POST" enctype="multipart/form-data">
this my route:
Route::resource('admin/panitia', PanitiaController::class);
试试这个
web.php
Route::resource('admin/panitia', PanitiaController::class);
如果你的路径如上所述,那么你的控制器函数将如下:
PanitiaController.php
public function edit($pantia_id)
{
$panitias = Panitia::find($pantia_id);
return view('admin.panitia.edit', compact('panitias'));
}
和表单代码如下所示:
edit.blade.php
<form action="{{ route('panitia.update', $panitias->id) }}" method="POST" enctype="multipart/form-data">
['route' =>[' panitia.update ', panitias→美元id]]
也检查你的路由,它是一个资源路由吗?