<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

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

class TransaksiInventaris extends Model
{
	protected $table = 'data_inventaris_trans';
	protected $primaryKey = 'trans_id';
	public $incrementing = false;
	public $timestamps = false;

	protected $casts = [
		'nominal' => 'int',
		'trans_tglbuku' => 'datetime',
		'trans_date' => 'datetime',
		'created_by' => 'int',
		'updated_by' => 'int',
		'status' => 'int'
	];

	protected $fillable = [
		'trans_kode',
		'trans_akun',
		'inventaris_id',
		'nominal',
		'trans_catatan',
		'trans_tglbuku',
		'trans_date',
		'created_by',
		'updated_by',
		'status'
	];

	public function ref_akun()
	{
		return $this->belongsTo(Akun::class, 'trans_akun');
	}

	public function inventaris()
	{
		return $this->belongsTo(Inventaris::class, 'inventaris_id');
	}

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