<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

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

    protected $casts = [
        'masuk' => 'float',
        'keluar' => 'float',
        'trans_date' => 'datetime',
        'trans_tglbuku' => 'datetime',
        'created_by' => 'int',
        'status' => 'int'
    ];

    protected $guarded = [];

    public function akun()
    {
        return $this->hasOne(Akun::class, 'kode_akun', 'kode_akun');
    }

    public function kas()
    {
        return $this->hasOne(Kas::class, 'id', 'kas_id');
    }

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