当我单击删除按钮时,它会显示该错误。我无法找出问题所在。路由.php Route::post('api/email/create', ['as' => 'email.create', 'uses' => 'Havence\AutoMailController@create']); Route::get('automail/mail',['as'=>'email.mail','uses' => 'Havence\AutoMailController@mail']); Route::get('automail/index',['as'=>'email.index','uses' => 'Havence\AutoMailController@index']); Route::get('automail/edit/{id}',['as'=>'email.edit','uses' => 'Havence\AutoMailController@edit']); Route::post('automail/delete/{id}',['as'=>'email.delete','uses' => 'Havence\AutoMailController@destroy']);删除按钮功能 <form data-toggle="tooltip" title="Delete Template" data-placement="top" action="{{ route('email.delete', $mailTemplate->id) }}" method="POST"> {{csrf_field()}} <input name="_method" type="hidden" value="DELETE"> <button type="submit" class="imgb col-md-3 text-center p-2"><img src="https://img.icons8.com/nolan/40/delete-forever.png" ></button></form>控制器 public function destroy($id) { $mailTemplates = Ticket::find($id); $mailTemplates->delete(); return redirect('/index')->with('success', 'Ticket has been deleted!!'); }
1 回答
幕布斯6054654
TA贡献1876条经验 获得超7个赞
更改此因为您正在传递隐藏的_method
Route::post('automail/delete/{id}',['as'=>'email.delete','uses' => 'Havence\AutoMailController@destroy']);
到
Route::delete('automail/delete/{id}',['as'=>'email.delete','uses' => 'Havence\AutoMailController@destroy']);
添加回答
举报
0/150
提交
取消