当我单击删除按钮时,它会显示该错误。我无法找出问题所在。
路由.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!!');
}
幕布斯6054654
相关分类