<?php

namespace App\Models;

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

class Procedure extends Model
{
    use HasFactory, SoftDeletes;
    protected $table = "procedures";
    protected $fillable  = [
        'id',
        'title',
        'description',
        'entity_status',
        'stage_id',
    ];

    protected $hidden = [
        'updated_at',
        'deleted_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function opportunities()
    {
        return $this->belongsToMany(
            Opportunity::class,
            'opportunity_procedures',
            'procedure_id',
            'opportunity_id'
        )->withPivot('is_check');
    }
}
