<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class EtabProf extends Model
{
    use HasFactory;
    
    protected $fillable = ['professeur_id', 'etablissement_id', 'date_affectation', 'date_fin'];
    
    public function professeur(): BelongsTo
    { 
        return $this->belongsTo(Professeur::class); 
    }
    
    public function etablissement(): BelongsTo
    { 
        return $this->belongsTo(Etablissement::class); 
    }
    
    public function rapports(): HasMany 
    { 
        return $this->hasMany(Rapport::class); 
    }
}
