<?php

namespace App\Models;

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

class UnitKerja extends Model
{
    use HasFactory;

    protected $table = 'unit_kerja';

    protected $fillable = [
        'nama_unit',
    ];

    public function jabatanFungsional(): HasMany
    {
        return $this->hasMany(JabatanFungsional::class, 'unit_kerja_id');
    }

    public function admins(): HasMany
    {
        return $this->hasMany(User::class, 'unit_kerja_id');
    }

    public function kodeAksesKantor(): HasMany
    {
        return $this->hasMany(KodeAksesKantor::class, 'unit_kerja_id');
    }
}
