Laravel方法不允许例外(Laravel method not allowed exception)
我似乎无法找出为什么我的提交给我回到MethodNotAllowedException 。 缩短了......这是表格:
<form role="form" id="tryitForm" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{{route('user.update', Auth::user()->id)}}"> <input type="submit" class="btn btn-primary" name="save" value="Update"/>我的路线设置如下:
Route::resource('user', 'UserController');I can't seem to find out why does my submit give me back the MethodNotAllowedException. Shortened...here is the form:
<form role="form" id="tryitForm" class="form-horizontal" enctype="multipart/form-data" method="POST" action="{{route('user.update', Auth::user()->id)}}"> <input type="submit" class="btn btn-primary" name="save" value="Update"/>And I have route set up as:
Route::resource('user', 'UserController');最满意答案
您需要在表单中添加PUT方法。
<input name="_method" value="PUT" type="hidden"> <input type="hidden" value="{{ csrf_token() }}" name="_token">You need to add PUT method into your form.
<input name="_method" value="PUT" type="hidden"> <input type="hidden" value="{{ csrf_token() }}" name="_token">更多推荐
发布评论