<?php

namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Models\Classe;
use App\Models\Bulletin;
use App\Models\Matiere;

use Illuminate\Database\Eloquent\Model;

class Prof extends Model
{
    use HasFactory;

    protected $fillable = ['first_name','last_name','phone','matiere_id'];

    public function classes()
    {
        return $this->belongsToMany(Classe::class, 'prof_classe_matiere')
                    ->withPivot('matiere_id', 'trimestre')
                    ->withTimestamps();
    }




    public function matieres()
    {
        return $this->belongsToMany(Matiere::class, 'prof_matiere');

    }

    public function studentGrades()
    {
        return $this->hasMany(StudentGrade::class, 'prof_id');
    }
}
