<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

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

/**
 * Class DataTabunganTran
 *
 * @property string $trans_id
 * @property string $trans_kode
 * @property string $rekening
 * @property int $setor
 * @property int $tarik
 * @property string $keterangan
 * @property Carbon $trans_date
 * @property Carbon $trans_tglbuku
 * @property int $created_by
 * @property int|null $deleted_by
 * @property int $status
 *
 * @property DataTabunganMaster $data_tabungan_master
 *
 * @package App\Models
 */
class TransaksiTabungan extends Model
{
    protected $table = 'data_tabungan_trans';
    protected $primaryKey = 'trans_id';
    public $incrementing = false;
    protected $keyType = 'string';
    public $timestamps = false;

    protected $casts = [
        'setor' => 'int',
        'tarik' => 'int',
        'trans_date' => 'datetime',
        'trans_tglbuku' => 'datetime',
        'created_by' => 'int',
        'deleted_by' => 'int',
        'status' => 'int'
    ];

    protected $guarded = [];

    public function tabungan()
    {
        return $this->belongsTo(Tabungan::class, 'rekening');
    }

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