Commit 889187cf by Triyah Fatmawati

Add hitung total harga

parent c42f52f2
...@@ -148,12 +148,15 @@ public function store(Request $request) { ...@@ -148,12 +148,15 @@ public function store(Request $request) {
$konaspi = json_decode($request->konaspi, true); $konaspi = json_decode($request->konaspi, true);
$hargaKonferensi = json_decode($request->hargaKonferensi, true); $hargaKonferensi = json_decode($request->hargaKonferensi, true);
$tglRegistrasi = $request->tglRegistrasi; $tglRegistrasi = $request->tglRegistrasi;
$totalHarga = $request->totalHarga; // $totalHargas = $request->totalHarga;
$registrasi = Registrasi::query()->create($registrasi); $registrasi = Registrasi::query()->create($registrasi);
$id_registrasi = $registrasi->id; $id_registrasi = $registrasi->id;
$jumlahKeg = count($kegiatanpeserta); $jumlahKeg = count($kegiatanpeserta);
//inisial harga
$totalHarga = (int) $konaspi['harga'];
foreach($kegiatanpeserta as $keg){ foreach($kegiatanpeserta as $keg){
$kegpeserta = [ $kegpeserta = [
'id_registrasi' => $id_registrasi, 'id_registrasi' => $id_registrasi,
...@@ -161,6 +164,11 @@ public function store(Request $request) { ...@@ -161,6 +164,11 @@ public function store(Request $request) {
'id_konferensi' => $keg['id_konferensi'], 'id_konferensi' => $keg['id_konferensi'],
]; ];
KegiatanPeserta::query()->create($kegpeserta); KegiatanPeserta::query()->create($kegpeserta);
if($keg['id_kegiatan'] != '498633a9-082c-4a4a-9dbd-e20b678ec15e'){
$konferensi = Konferensi::query()->where('id', $keg['id_konferensi'])->first();
$totalHarga += (int) $konferensi->harga;
}
} }
$multipartData = [ $multipartData = [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment