<?php

namespace App\Models;

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

class Distribution extends Model
{
    use HasFactory;

    protected $table = 'distribusis';

    protected $fillable = [
        'qurban_participant_id',
        'status',
        'dititipkan_ke',
        'scanned_at',
    ];

    protected $casts = [
        'scanned_at' => 'datetime',
    ];

    public function participant()
    {
        return $this->belongsTo(QurbanParticipant::class, 'qurban_participant_id');
    }

    public function entrustee()
    {
        return $this->belongsTo(QurbanParticipant::class, 'dititipkan_ke');
    }
}
