我创建了如下所示的路线
Route::resource('reports/', 'ReportController')->middleware('auth');
在路线列表中,我有如下列表
DELETE | reports/{} | destroy | App\Http\Controllers\ReportController@destroy
在 index.blade.php 我创建了一个删除按钮,如下所示
<form method="post" action="{{route('destroy',['report'=>$report->id])}}" onsubmit="return confirm('Are you sute to delete?')">
@csrf
@method("delete")
<button type="submit" class="btn btn-danger btn-sm">Delete</button>
</form>
ReportController 销毁方法:
public function destroy(Report $report)
{
//
}
但我得到以下错误
Missing required parameters for [Route: destroy] [URI: reports/{}].