<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Departement extends Model
{
    protected $connection = 'tenant';
    protected $table = 'departement';
    protected $primaryKey = 'idDepartement';
    public $timestamps = false;

    protected $fillable = [
        'sigledept',
        'desrdept',
        'logoDepart',
        'idEtablissement',
        'enseignant',
        'valide'
    ];

    protected $casts = [
        'valide' => 'boolean',
    ];

    /**
     * Get the filieres (programs) in this department
     */
    public function filieres()
    {
        return $this->hasMany(Filiere::class, 'departement', 'idDepartement');
    }

    /**
     * Scope to filter only valid entries
     */
    public function scopeValide($query)
    {
        return $query;
    }
}
