[英]MethodNotAllowedHttpException in RouteCollection.php line 218 laravel 5.2 on update data
Please help me, im newbie in laravel and get an error when I will update data field from button, like this 请帮助我,我是laravel的新手,当我从按钮更新数据字段时出现错误,就像这样
MethodNotAllowedHttpException in RouteCollection.php line 218: RouteCollection.php第218行中的MethodNotAllowedHttpException:
and im using Routes : 和即时通讯使用Routes :
Route::post('/verify', 'DataPelamarController@verify');
and I write my Controller like bellow: 我像下面这样写我的控制器 :
public function verify(Request $request, $id){
DB::table('databeasiswas')->update([
'status_pendaftaran'=>'1']);
return redirect(url('pendaftar'));
}
and this is my view 这是我的看法
<a href ="{{ url('verify') }}" name="_method" type="hidden" value="PATCH" >
<button type="submit" class="btn btn-vk btn-sm"><i class="fa fa-check"></i> Verify Data</button>
</a>
thanks before.. 之前谢谢..
Just change this line. 只需更改此行。 Patch is for updating, Post for new db entries. 补丁用于更新,发布用于新的数据库条目。 This is just a convention. 这只是一个约定。 You can use post for both. 您可以同时使用post。
Route::patch('/verify', 'DataPelamarController@verify');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.