#multi edit id[]

13 messages · Page 1 of 1 (latest)

sly egret
#

im confuse how can i show multiple rows for edit when √ checkbox here im showing my
controller:
public function multiupdate(Request $request){
$id = $request->id;
data_peserta::whereIn('id', $id)->update($request->all());
return redirect()->route('/admin/peserta')->with('success',' Data-Data Berhasil Di Edit');
}
web.php:
Route::post('/admin/data_peserta/multiup', [DataPesertaController::class, 'multiupdate'])->name('/multi-update/peserta')->middleware('is_admin');
and my view :
<form id="myForm" method="POST">
@csrf
<!-- Other form fields go here -->
<button type="button" onclick="Edit()">Edit</button>
<table id="example1" class="table table-bordered table-striped">
<thead>
</thead>
<tbody>
@foreach ($data as $row)
<td><input type="checkbox" name="id[{{ $row->id }}]" value="{{ $row->id }}"></td>
</form>
<script>
function Edit(){
var form = document.getElementById('myForm');

  // Submit to the first URL
  form.action = '/admin/data_peserta/multiedit';
  form.submit();

}
</script>
please help im stuck btw i cant use ajax (laravel 8)

rare palm
#

clearly explain the exact issue

sly egret
#

i just want multiple edit lemme screenshot it

sly egret
rare palm
#

and what's the issue?

sly egret
#

i search around in internet but cant find the exact thing i want

rare palm
#
  1. You want to grab all the checked id's when the edit button it clicked and pass that through to the request
#

first get that going

#

in your controller, dump the request to make sure all the id's are coming through as expected

sly egret
#

owh okay

#

then?

rare palm
#

after that is working