<?php

namespace App\Models;

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

class Dusun extends Model
{
    use HasFactory;

    protected $table = 'dusun'; // Nama tabel jika berbeda dari konvensi (plural dari model)

    protected $fillable = [
        'nama',
        'alamat',
        'email',
        'phone',
        'tipe',
        'status',
    ];

    /**
     * Get all of the penduduk for the Dusun
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function penduduk(): HasMany
    {
        return $this->hasMany(Penduduk::class);
    }

    /**
     * Get all of the kartuKeluarga for the Dusun
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function kartuKeluarga(): HasMany
    {
        return $this->hasMany(KartuKeluarga::class);
    }
}