<?php

namespace App\Models;

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

class Profesion extends Model
{
    use HasFactory;

    protected $table = 'profesiones';

    protected $fillable =[
        'titulo',
        'visible_en_formulario',
    ];

    public function profesionales()
    {
        return $this->hasMany(Profesional::class, 'profesion_id', 'id');
    }

    public function profesionalesAsociados()
    {
        return $this->belongsToMany(Profesional::class, 'profesionales_profesiones', 'profesion_id', 'profesional_id');
    }
}
