<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Class TableTransaksi
 * 
 * @property string $kode
 * @property string $nama
 * @property string|null $debet1
 * @property string|null $debet2
 * @property string|null $kredit1
 * @property string|null $kredit2
 * @property int $status
 * 
 * @property Collection|DataInventarisTran[] $data_inventaris_trans
 * @property Collection|DataKreditTransAngsuran[] $data_kredit_trans_angsurans
 * @property Collection|DataKreditTransRealisasi[] $data_kredit_trans_realisasis
 * @property Collection|DataTransJurnal[] $data_trans_jurnals
 *
 * @package App\Models
 */
class TableTransaksi extends Model
{
	protected $table = 'table_transaksi';
	protected $primaryKey = 'kode';
	public $incrementing = false;
	public $timestamps = false;

	protected $casts = [
		'status' => 'int'
	];

	protected $fillable = [
		'nama',
		'debet1',
		'debet2',
		'kredit1',
		'kredit2',
		'status'
	];

	public function data_inventaris_trans()
	{
		return $this->hasMany(DataInventarisTran::class, 'trans_kode');
	}

	public function data_kredit_trans_angsurans()
	{
		return $this->hasMany(DataKreditTransAngsuran::class, 'trans_kode');
	}

	public function data_kredit_trans_realisasis()
	{
		return $this->hasMany(DataKreditTransRealisasi::class, 'trans_kode');
	}

	public function data_trans_jurnals()
	{
		return $this->hasMany(DataTransJurnal::class, 'trans_kode');
	}
}
