fix primary key

This commit is contained in:
hafifierahman
2023-06-07 07:39:23 +08:00
parent 6ae8ccbbdd
commit ce822c3e6b
+7 -10
View File
@@ -377,16 +377,13 @@ class RingkasanHarianServices
public function StoreRingkasanHarian(){ 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(); $cawangan = Cawangan::on('mysql7')->where('kodcaw','KB2')->get()->toArray();
// foreach() foreach($cawangan as $index=>$caw){
foreach($period as $current){ foreach($period as $current){
foreach($cawangan as $index=>$caw){
DB::connection($caw['mysql'])->beginTransaction(); DB::connection($caw['mysql'])->beginTransaction();
try{ try{
$getTransaksi = $this->getTransaksiHarian($current->toDateString(),$caw['kodcaw'],$caw['mysql']); $getTransaksi = $this->getTransaksiHarian($current->toDateString(),$caw['kodcaw'],$caw['mysql']);
$getPendser = $this->getPendahuluanSerahanHQ($current->toDateString(),$caw['kodcaw'],$caw['mysql']); $getPendser = $this->getPendahuluanSerahanHQ($current->toDateString(),$caw['kodcaw'],$caw['mysql']);
$getPerbelanjaan = $this->getPerbelanjaan($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->tebus()->save($tebus);
$main->lelong()->save($lelong); $main->lelong()->save($lelong);
$main->gad_id = $gadai->id; $main->gad_id = $gadai->gad_id;
$main->teb_id = $tebus->id; $main->teb_id = $tebus->teb_id;
$main->ans_id = $ansuran->id; $main->ans_id = $ansuran->ans_id;
$main->lel_id = $lelong->id; $main->lel_id = $lelong->lel_id;
}else{ }else{
$ansuran->save(); $ansuran->save();
$tebus->save(); $tebus->save();