tambah table log update np sjp

This commit is contained in:
Fadila
2025-09-22 09:19:52 +07:00
parent a29c39086a
commit 42ea2e108d
4 changed files with 88 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace App\Console\Commands;
use App\Models\LivechatUpdateLog;
use App\Models\OLDLMS\Livechat;
use Carbon\Carbon;
use Illuminate\Console\Command;
@@ -32,11 +33,24 @@ class UpdateNoSJP extends Command {
]);
$body = json_decode($response->getBody()->getContents(), true);
$this->info('Jumlah Livechat dikirim: ' . $liveChats->count());
LivechatUpdateLog::create([
'nIDLivechat' => $row->nID,
'nIDSummary' => $row->summary_id,
'status' => 'success',
'response' => json_encode($body)
]);
$this->info("Nomor SJP berhasil dibuat untuk Livechat {$row->nID}");
} catch (\Exception $e) {
LivechatUpdateLog::create([
'nIDLivechat' => $row->nID,
'nIDSummary' => $row->summary_id,
'status' => 'fail',
'response' => $e->getMessage()
]);
$this->error("Gagal generate Nomor SJP Livechat {$row->nID}: " . $e->getMessage());
}
}