<?php

namespace App\Models;

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

class Karyawan extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',
        'instansi_id',
        'jabatan_id',
        'jam_kerja_id',
        'nip',
        'nama',
        'no_hp',
        'alamat',
    ];

    // 🔥 Relasi
    public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function instansi()
    {
        return $this->belongsTo(Instansi::class);
    }

    public function jabatan()
    {
        return $this->belongsTo(Jabatan::class);
    }

public function jamKerja()
{
    return $this->belongsTo(JamKerja::class);
}


    public function absensis()
    {
        return $this->hasMany(Absensi::class);
    }

    public function izinSakits()
    {
        return $this->hasMany(IzinSakit::class);
    }
}
