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:
@@ -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());
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user