1
votes

Please help me, im newbie in laravel and get an error when I will update data field from button, like this

MethodNotAllowedHttpException in RouteCollection.php line 218:

and im using 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..

1

1 Answers

0
votes

Just change this line. Patch is for updating, Post for new db entries. This is just a convention. You can use post for both.

Route::patch('/verify', 'DataPelamarController@verify');