<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class StikerTrans extends Model
{
    use HasFactory;

    protected $table = 'transaksi_stiker';

    protected $fillable = [
        'notrans','nama','alamat', 'telepon', 'jenis_transaksi', 'awal', 'harga', 'keterangan', 'tanggal' , 'operator' , 
        'akhir'  , 'maks'  , 'no_id'  , 'unit_kerja', 'no_induk'  , 'jenis_stiker' , 'hari_ke'  ,'jenis_langganan' ,
        'exit_pass' , 'no_kuitansi', 'tgl_edited', 'tipe_exit_pass', 'seq_code' , 'unitno'   , 'area'  , 'reserved', 
        'batasan_jam', 'batasan_awal', 'batasan_akhir', 'asuransi'       
    ];

    public $with = ['stiker_details', 'memberCard'];

    public function stiker_details ()
    {
        return $this->hasMany(StikerTransDetail::class, 'notrans', 'notrans');
    }

    public function memberCard () 
    {
        return $this->hasMany(MemberCard::class, 'notrans', 'no_id');
    }
}
