<?php

namespace App\Models;

use App\Casts\DocDataCast;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Human extends Model
{
    use HasFactory;

    protected $table = "HUMAN";
    protected $primaryKey = 'RID';
    const CREATED_AT = 'DATE_CREATED';
    const UPDATED_AT = 'DATE_MODIFIED';

    /**
     * Relates to fk address birth
     * @return BelongsTo
     */
    public function addressBirth(): BelongsTo
    {
        return $this->belongsTo(Address::class, 'adrref_birth', 'rid');
    }
    /**
     * Relates to fk address live
     * @return BelongsTo
     */
    public function addressLive(): BelongsTo
    {
        return $this->belongsTo(Address::class, 'adrref_live', 'rid');
    }

    /**
     *
     * @return HasMany
     */
  public function docum(): HasMany
    {
        return $this->hasMany(Docum::class, 'RID_H','RID');
    }
}
