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 {
|
try {
|
||||||
|
if( $data['account_number'] !== 'account_number') {
|
||||||
// Use firstOrNew instead of updateOrCreate
|
// Use firstOrNew instead of updateOrCreate
|
||||||
$account = Account::firstOrNew(['account_number' => $data['account_number']]);
|
$account = Account::firstOrNew(['account_number' => $data['account_number']]);
|
||||||
$account->fill($data);
|
$account->fill($data);
|
||||||
$account->save();
|
$account->save();
|
||||||
$rowCount++;
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Log::error('Error processing Account: ' . $e->getMessage());
|
Log::error('Error processing Account: ' . $e->getMessage());
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ class Account extends Model
|
|||||||
*/
|
*/
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'account_number',
|
'account_number',
|
||||||
'customer_no',
|
'customer_code',
|
||||||
'currency',
|
'currency',
|
||||||
'opening_date',
|
'opening_date',
|
||||||
'co_code',
|
'branch_code',
|
||||||
'open_category',
|
'open_category',
|
||||||
'start_year_bal',
|
'start_year_bal',
|
||||||
'closure_date',
|
'closure_date',
|
||||||
|
|||||||
Reference in New Issue
Block a user