<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class PenempatanBank extends Model
{
    protected $table = 'data_penempatan_master';
    protected $keyType = 'string';
    public $incrementing = false;

    protected $casts = [
        'tgl_penempatan' => 'datetime',
        'jenis' => 'int',
        'suku_bunga' => 'float',
        'jkw' => 'int',
        'tgl_buka' => 'datetime',
        'penempatan_jth_tempo' => 'datetime',
        'tgl_tutup' => 'datetime',
        'saldo' => 'int',
        'created_by' => 'int',
        'updated_by' => 'int',
        'status' => 'int'
    ];

    protected $guarded = [];

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

    public function bank()
    {
        return $this->belongsTo(Bank::class);
    }
}
