<?php

namespace App\Models;

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

/**
 * @property int $id
 * @property string $libelle
 */
class Role extends Model
{
    use HasFactory;

    // Cette ligne est CRUCIALE : elle autorise Laravel à remplir la colonne 'libelle'
    protected $fillable = ['libelle'];

    public function users()
    {
        return $this->hasMany(User::class, 'id_role');
    }
}
