<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

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

/**
 * Class DataKreditAngsuran
 *
 * @property int $id
 * @property string $trans_id
 * @property int $jenis_trans
 * @property string|null $anggota_id
 * @property string $rekening
 * @property int $plafon
 * @property int $realisasi
 * @property Carbon $angsuran_tgl
 * @property int $tagihan_pokok
 * @property int $tagihan_bunga
 * @property int $angsuran_pokok
 * @property int $angsuran_bunga
 * @property int $tunggakan_bunga
 * @property int $tunggakan_pokok
 * @property int $kolektibilitas
 *
 * @property DataKreditMaster $data_kredit_master
 *
 * @package App\Models
 */
class AngsuranKredit extends Model
{
	protected $table = 'data_kredit_angsuran';
	public $timestamps = false;

	protected $casts = [
		'jenis_trans' => 'int',
		'plafon' => 'int',
		'realisasi' => 'int',
		'angsuran_tgl' => 'datetime',
		'tagihan_pokok' => 'int',
		'tagihan_bunga' => 'int',
		'angsuran_pokok' => 'int',
		'angsuran_bunga' => 'int',
		'tunggakan_bunga' => 'int',
		'tunggakan_pokok' => 'int',
		'kolektibilitas' => 'int'
	];

	protected $fillable = [
		'trans_id',
		'jenis_trans',
		'anggota_id',
		'rekening',
		'plafon',
		'realisasi',
		'angsuran_tgl',
		'tagihan_pokok',
		'tagihan_bunga',
		'angsuran_pokok',
		'angsuran_bunga',
		'tunggakan_bunga',
		'tunggakan_pokok',
		'kolektibilitas'
	];

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