Files
webstatement/app/Models/StmtEntry.php
daengdeni def0b037a8 feat(statement-processing): update StmtEntry model and optimize data processing logic
- Menambahkan relasi baru pada model `StmtEntry`:
  - `ft()` untuk relasi ke model `TempFundsTransfer` berdasarkan kolom `trans_reference`.
  - `transaction()` untuk relasi ke model `TempTransaction` berdasarkan kolom `transaction_code`.

- Memperbarui `ProcessStmtEntryDataJob`:
  - Mengganti penggunaan model `TempStmtEntry` menjadi `StmtEntry`.
  - Mengubah delimiter parsing file CSV dari `/` menjadi `~`.
  - Menggunakan `stmt_entry_id` sebagai kunci utama dalam metode `updateOrCreate`.
  - Menghapus validasi kolom `_id` pada data yang diproses.

Perubahan ini bertujuan untuk menyelaraskan model dan cara proses data agar lebih akurat dan sesuai dengan kebutuhan sistem.
2025-05-21 21:18:04 +07:00

68 lines
1.4 KiB
PHP

<?php
namespace Modules\Webstatement\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
// use Modules\Webstatement\Database\Factories\StmtEntryFactory;
class StmtEntry extends Model
{
use HasFactory;
/**
* The table associated with the model.
*
* @var string
*/
protected $table = 'stmt_entry';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'stmt_entry_id',
'account_number',
'company_code',
'amount_lcy',
'transaction_code',
'narrative',
'product_category',
'value_date',
'amount_fcy',
'exchange_rate',
'trans_reference',
'booking_date',
'stmt_no',
'date_time',
'currency',
'crf_type',
'consol_key',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
public function account()
{
return $this->belongsTo(Account::class, 'account_number', 'account_number');
}
public function ft(){
return $this->belongsTo(TempFundsTransfer::class, 'trans_reference', 'ref_no');
}
public function transaction(){
return $this->belongsTo(TempTransaction::class, 'transaction_code', 'transaction_code');
}
}