feat(account): perbarui logika pemrosesan data akun

- Tambahkan pengecekan untuk memastikan 'account_number' tidak sama dengan string 'account_number' sebelum menyimpan data akun.
- Perbarui atribut yang dapat diisi pada model Account dengan mengganti 'customer_no' menjadi 'customer_code' dan 'co_code' menjadi 'branch_code'.
This commit is contained in:
Daeng Deni Mardaeni
2025-04-09 13:39:16 +07:00
parent 79c4aa1d39
commit 500cf2b26a
2 changed files with 8 additions and 7 deletions

View File

@@ -58,11 +58,12 @@
}
try {
// Use firstOrNew instead of updateOrCreate
$account = Account::firstOrNew(['account_number' => $data['account_number']]);
$account->fill($data);
$account->save();
$rowCount++;
if( $data['account_number'] !== 'account_number') {
// Use firstOrNew instead of updateOrCreate
$account = Account::firstOrNew(['account_number' => $data['account_number']]);
$account->fill($data);
$account->save();
}
} catch (Exception $e) {
Log::error('Error processing Account: ' . $e->getMessage());

View File

@@ -15,10 +15,10 @@ class Account extends Model
*/
protected $fillable = [
'account_number',
'customer_no',
'customer_code',
'currency',
'opening_date',
'co_code',
'branch_code',
'open_category',
'start_year_bal',
'closure_date',