<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AlamatUser extends Model
{
    protected $fillable = [
        'user_id',
        'label',
        'nama_penerima',
        'no_telp',
        'provinsi_id',
        'kota_id',
        'kecamatan_id',
        'desa_id',
        'kode_pos',
        'alamat_lengkap',
        'is_utama',
    ];

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

    public function provinsi()
    {
        return $this->belongsTo(\App\Models\Province::class, 'provinsi_id');
    }

    public function regency()
    {
        return $this->belongsTo(\App\Models\Regency::class, 'kota_id');
    }

    public function kecamatan()
    {
        return $this->belongsTo(\App\Models\District::class, 'kecamatan_id');
    }

    public function desa()
    {
        return $this->belongsTo(\App\Models\Village::class, 'desa_id');
    }
}
