dimanche 1 décembre 2019

The GET method is not supported for this route. Supported methods: PATCH. when doing update

i want to submit for updating the data, i already use the patch method, but it keep telling me that the get method is not supported

the edit formedit.info.blade

 <form action="" method="patch" enctype="multipart/form-data">
            <input type="hidden" name="_method" value="patch">
            <input type="hidden" name="_token" value="">

the route list web.php

//info penting
route::get('/info-admin','InfosController@index')->middleware('auth','admin')->name('admin.info-admin');
route::get('/tambah-info','PagesController@tambah')->middleware('auth','admin')->name('info.add');

route::patch('/update-info/{info}/update','InfosController@update')->name('info.update');
route::get('/edit-info/{info}/edit','InfosController@edit')->middleware('auth','admin')->name('info.edit');


route::delete('/info/{id}','InfosController@destroy')->middleware('auth','admin')->name('info.destroy');

here's for update logic InfosController

public function update(Request $request, Info $info)
    {
         Info::where('id', $info->id)
            ->update([
                'judul' => $request->judul,
               'konten' => $request->konten,
                'image' => $request->image,
             ]);
     return redirect('')->route('admin.info-admin')->with('success', 'Successful');
    }

what did i do wrong?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire