This question is about to edit my data in my table. the view or the form has shown perfectly. but when i edit my data and press update button, it show MethodNotAllowedHttpException error. Did my Method wrong?
this is the view
<form class="form-horizontal form-label-left" method="post" action="">
<div class="item form-group">
<input name="_method" type="hidden" value="PATCH">
<label class="control-label col-md-3 col-sm-3 col-xs-12">ID Ruangan <span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="title" name="title" value="">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Nama Ruangan <span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="title" name="title" value="">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12">Keterangan <span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input type="text" class="form-control form-control-lg" id="lgFormGroupInput" placeholder="title" name="title" value="">
</div>
</div>
<div class="form-group row">
<div class="col-md-2"></div>
<button type="submit" class="btn btn-primary">Update</button>
</div>
</form>
This is the AdminController
public function updateruang(Request $request, $id_ruang)
{
$ruang = Ruang::find($id_ruang);
$ruang->nm_ruang = $request->get('nm_ruang');
$ruang->keterangan = $request->get('keterangan');
$ruang->save();
return redirect('/admin/dataruang')->with('success', 'New data has been updated!!');
}
This is the route
Route::post('/editdataruang{id_ruang}','AdminController@updateruang', function(){
$users[] = Auth::user();
$users[] = Auth::guard()->user();
$users[] = Auth::guard('admin')->user();
})->name('editdataruang');
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire