为了账号安全,请及时绑定邮箱和手机立即绑定

Symfony \ Component \ HttpKernel \ Exception

Symfony \ Component \ HttpKernel \ Exception

胡说叔叔 2022-05-14 14:00:51
当我单击删除按钮时,它会显示该错误。我无法找出问题所在。路由.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']);



查看完整回答
反对 回复 2022-05-14
  • 1 回答
  • 0 关注
  • 91 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信