<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class DataKreditTransAngsuran
 *
 * @property string $trans_id
 * @property int|null $trans_jenis
 * @property string $trans_kode
 * @property string $rekening
 * @property int $pokok
 * @property int $bunga
 * @property int $denda
 * @property int $total
 * @property string|null $keterangan
 * @property Carbon $trans_tglbuku
 * @property Carbon $trans_date
 * @property int $created_by
 * @property int $status
 *
 * @property DataKreditMaster $data_kredit_master
 * @property TableTransaksi $table_transaksi
 *
 * @package App\Models
 */
class TransaksiAngsuranKredit extends Model
{
	protected $table = 'data_kredit_trans_angsuran';
	protected $primaryKey = 'trans_id';
	public $incrementing = false;
	public $timestamps = false;

	protected $casts = [
		'trans_jenis' => 'int',
		'pokok' => 'int',
		'bunga' => 'int',
		'denda' => 'int',
		'total' => 'int',
		'trans_tglbuku' => 'datetime',
		'trans_date' => 'datetime',
		'created_by' => 'int',
		'status' => 'int'
	];

	protected $fillable = [
		'trans_jenis',
		'trans_kode',
		'rekening',
		'pokok',
		'bunga',
		'denda',
		'total',
		'keterangan',
		'trans_tglbuku',
		'trans_date',
		'created_by',
		'status'
	];

	public function kredit()
	{
		return $this->belongsTo(Kredit::class, 'rekening');
	}

	public function ref_transaksi()
	{
		return $this->belongsTo(TableTransaksi::class, 'trans_kode');
	}
}
