From e326a22f4b695f0cf093081a680d0d30fa508594 Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 31 May 2025 22:26:14 +0800 Subject: [PATCH 1/2] added update cron ig all --- app/Console/Commands/updateImbangDuga.php | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 app/Console/Commands/updateImbangDuga.php diff --git a/app/Console/Commands/updateImbangDuga.php b/app/Console/Commands/updateImbangDuga.php new file mode 100644 index 0000000..897958f --- /dev/null +++ b/app/Console/Commands/updateImbangDuga.php @@ -0,0 +1,81 @@ +option('all')){ + $zone = 'all'; + }else if($this->option('1')){ + $zone = '1'; + }else if ($this->option('2')){ + $zone = '2'; + }else if ($this->option('3')){ + $zone = '3'; + } + + $monthly = Carbon::now(); + $monthly = new Carbon(); + + $previousmonth = $monthly->subMonthsNoOverflow()->endOfMonth(); + $tahun = $previousmonth->year; + $month = $previousmonth->month; + + $response = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/reports/updateigall',[ + 'month' => $month, + 'year' => $tahun, + ]); + + if ($response->successful()) { + $data = $response->json(); + Log::info()('Imbang Duga update successful', [ + 'month' => $month, + 'year' => $tahun, + 'data' => $data + ]); + $this->info('Imbang Duga update successful'); + } else { + Log::error('API error', [ + 'url' => $response->effectiveUri(), + 'status' => $response->status(), + 'body' => $response->body() + ]); + } + } +} From 08bf5cb653187c2fa548dac2c6243bc663b39f4a Mon Sep 17 00:00:00 2001 From: Hafifie PKB Date: Sat, 31 May 2025 22:30:15 +0800 Subject: [PATCH 2/2] log info mistype --- app/Console/Commands/updateImbangDuga.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Commands/updateImbangDuga.php b/app/Console/Commands/updateImbangDuga.php index 897958f..0af8bd6 100644 --- a/app/Console/Commands/updateImbangDuga.php +++ b/app/Console/Commands/updateImbangDuga.php @@ -64,7 +64,7 @@ class updateImbangDuga extends Command if ($response->successful()) { $data = $response->json(); - Log::info()('Imbang Duga update successful', [ + Log::info('Imbang Duga update successful', [ 'month' => $month, 'year' => $tahun, 'data' => $data