<?php

namespace App\Models;

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

class Requirement extends Model
{
    use HasFactory;

    protected $fillable = [
        'date',
        'id_store',
        'id_user',
        'id_deposit',
        'codigo',
        'status'
    ];

    public function store()
    {
        return $this->belongsTo(Store::class, 'id_store');
    }

    public function user()
    {
        return $this->belongsTo(User::class, 'id_user');
    }
    public function deposit()
    {
        return $this->belongsTo(Deposit::class, 'id_deposit');
    }

    public function costRequirements()
    {
        return $this->hasMany(CostRequirement::class, 'id_requirement');
    }
}
