<?php

namespace App\Models;

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

class ProductoSector extends Model
{
    use HasFactory;

    protected $table = 'productos_sectores';

    public function Producto()
    {
        return $this->belongsTo(Producto::class, 'product_id');
    }

    public function Sector()
    {
        return $this->belongsTo(Sector::class, 'sector_id');
    }

    public function flujos()
    {
        return $this->hasMany(OtiFlujo::class, 'oti_id');
    }

    public function flujos_pendientes()
    {
        return $this->hasMany(OtiFlujo::class, 'oti_id')->where('status', '!=', 4);
    }
}
