как добавить массивы в контроллер? как добавить массив для входа в базу данных с помощью addrow в laravel?
нужна его помощь
javascript addrow
function formatRows(main, prefer, common,satuanu,kodeu) {
return '<tr style="text-align: center;"><td class="col-xs-3"><input type="text" value="' +main+ '" id="kode_bmn" name="kode_bmn[]" class="form-control editable" readonly/></td>' +
'<td class="col-xs-3"><input type="text" value="' +prefer+ '" id="jenis_barang" name="jenis_barang[]" class="form-control editable" readonly/></td>' +
'<td class="col-xs-3"><input type="text" value="' +common+ '"id="kuantitas" name="kuantitas[]" class="form-control editable" readonly/></td>' +
'<td class="col-xs-3"><input type="text" value="' +satuanu+ '"id="satuan_ukuran" name="satuan_ukuran[]" class="form-control editable" readonly/></td>' +
'<td class="col-xs-3"><input type="text" value="' +kodeu+ '" id="kode_unit" name="kode_unit[]" class="form-control editable" readonly/></td>'+
'<td class="col-xs-1 text-center"><a href="#" onClick="deleteRow(this)">' +
'<i class="fa fa-trash" aria-hidden="true"></a></td></tr>';
};
Контроллер
public function store_pesanan(request $request ,$id){
if(!Session::get('login')){
return redirect('/login')->with('alert','Kamu harus login dulu');
}
else{
DB::table('tbl_paket')
->where('id_paket',$id)
->update(['status_paket' => $request->status_paket]);
$data = new ModelPesanan();
$data->id_paket = $request->get('id_paket');
$data->kode_bmn = $request->get('kode_bmn');
$data->kode_unit = $request->get('kode_unit');
$data->jenis_barang = $request->get('jenis_barang');
$data->kuantitas = $request->get('kuantitas');
$data->satuan_ukuran = $request->get('satuan_ukuran');
$data->status_pesanan = $request->get('status_pesanan');
$data->save();
Alert::success('Sukses!', 'Berhasil Menambahkan Pesanan!');
return redirect ('/daftar_paket');
}
}
пожалуйста, помогите мне