From ce822c3e6b5a3492a05521183c31b4196fb68142 Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Wed, 7 Jun 2023 07:39:23 +0800 Subject: [PATCH] fix primary key --- app/Services/RingkasanHarianServices.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/Services/RingkasanHarianServices.php b/app/Services/RingkasanHarianServices.php index 7c1f4f0..765e5cc 100644 --- a/app/Services/RingkasanHarianServices.php +++ b/app/Services/RingkasanHarianServices.php @@ -377,16 +377,13 @@ class RingkasanHarianServices public function StoreRingkasanHarian(){ - $period = CarbonPeriod::create('2023-01-01', '2023-03-31'); + $period = CarbonPeriod::create('2023-01-01', '2023-05-31'); $cawangan = Cawangan::on('mysql7')->where('kodcaw','KB2')->get()->toArray(); - // foreach() - foreach($period as $current){ - foreach($cawangan as $index=>$caw){ + foreach($cawangan as $index=>$caw){ + foreach($period as $current){ DB::connection($caw['mysql'])->beginTransaction(); - try{ - $getTransaksi = $this->getTransaksiHarian($current->toDateString(),$caw['kodcaw'],$caw['mysql']); $getPendser = $this->getPendahuluanSerahanHQ($current->toDateString(),$caw['kodcaw'],$caw['mysql']); $getPerbelanjaan = $this->getPerbelanjaan($current->toDateString(),$caw['kodcaw'],$caw['mysql']); @@ -469,10 +466,10 @@ class RingkasanHarianServices $main->tebus()->save($tebus); $main->lelong()->save($lelong); - $main->gad_id = $gadai->id; - $main->teb_id = $tebus->id; - $main->ans_id = $ansuran->id; - $main->lel_id = $lelong->id; + $main->gad_id = $gadai->gad_id; + $main->teb_id = $tebus->teb_id; + $main->ans_id = $ansuran->ans_id; + $main->lel_id = $lelong->lel_id; }else{ $ansuran->save(); $tebus->save();