<?php

namespace App\Models;

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

class Land extends Model
{
    use HasFactory;

    protected $table = 'land';
    protected $guarded = [];

    public function detailLands()
    {
        return $this->hasMany(LandDetails::class, 'land_id', 'id');
    }

    public function province()
    {
        return $this->belongsTo(Province::class, 'province_code', 'id');
    }

    public function regency()
    {
        return $this->belongsTo(Regency::class, 'regency_code', 'id');
    }

    public function district()
    {
        return $this->belongsTo(District::class, 'district_code', 'id');
    }
}
