<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

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

/**
 * Class DataKreditTransRealisasi
 *
 * @property string $trans_id
 * @property string $trans_kode
 * @property string $rekening
 * @property int $plafon
 * @property int $admin
 * @property int $provisi
 * @property int $penerimaan
 * @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 TransaksiRealisasiKredit extends Model
{
	protected $table = 'data_kredit_trans_realisasi';
	protected $primaryKey = 'trans_id';
	public $incrementing = false;
	public $timestamps = false;

	protected $casts = [
		'plafon' => 'int',
		'admin' => 'int',
		'provisi' => 'int',
		'penerimaan' => 'int',
		'trans_tglbuku' => 'datetime',
		'trans_date' => 'datetime',
		'created_by' => 'int',
		'status' => 'int'
	];

	protected $fillable = [
		'trans_kode',
		'rekening',
		'plafon',
		'admin',
		'provisi',
		'penerimaan',
		'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');
	}
}
