<?php

namespace App\Models\Master;

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

class Kelurahan extends Model
{
    use HasFactory;
    protected $table = 'ms_kelurahan';
    protected $primaryKey = 'MsKelurahanId';

    protected $fillable = [
        'ms_provinsi_id',
        'ms_kabupaten_id',
        'ms_kecamatan_id',
        'name',
        'kode_wilayah',
    ];

    public function provinsi()
    {
        return $this->belongsTo('\App\Models\Master\Provinsi','ms_provinsi_id','MsProvinsiId');
    }

    public function kabupaten()
    {
        return $this->belongsTo('\App\Models\Master\Kabupaten','ms_kabupaten_id','MsKabupatenId');
    }

     public function kecamatan()
    {
        return $this->belongsTo('\App\Models\Master\Kecamatan','ms_kecamatan_id','MsKecamatanId');
    }
}
