<?php

namespace App\Models;

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

class AreaMaster extends Model
{
    use HasFactory;

    protected $table = 'area_master';
    protected $primaryKey = 'Are_Id';

    public $timestamps = false;

    protected $fillable = [
        'Are_Code',
        'Are_Name',
        'Wrd_Id',
        'Is_Active'
        // 'Created_Date'
    ];

    protected $casts = [
        'Is_Active' => 'boolean'
    ];

    // protected static function boot()
    // {
    //     parent::boot();

    //     static::creating(function ($model) {
    //         $model->Created_Date = $model->Created_Date ?? now();
    //     });
    // }

    public function ward()
    {
        return $this->belongsTo(WardMaster::class, 'Wrd_Id', 'Wrd_Id');
    }
}
