Files
Ressources-relationnel/app/Models/Utilisateur_Progression.php
T
Azmog 1e6557729f
CD - Déploiement continu / deploy (push) Successful in 3m7s
CI - Intégration continue / quality-and-tests (push) Failing after 2m30s
feat: add HasCompositePrimaryKey trait for composite primary key support
- Introduced a new trait `HasCompositePrimaryKey` to enable Eloquent models to handle composite primary keys, which are not supported natively by Eloquent. The trait requires models to implement a method to define the composite key columns and manages key retrieval for save and select queries.

chore: add GrumPHP configuration for pre-commit checks

- Added a `grumphp.yml` configuration file to enforce code style and static analysis checks before commits. This setup includes Laravel Pint for code style and Larastan for static analysis, ensuring code quality and consistency.

chore: create PHPStan configuration file

- Created a `phpstan.neon` file to configure PHPStan with Larastan for static analysis. The configuration specifies the paths to analyze and sets the analysis level to 5 for a balance between catching bugs and avoiding excessive strictness.
2026-07-06 12:06:54 +02:00

54 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use App\Models\Concerns\HasCompositePrimaryKey;
use Illuminate\Database\Eloquent\Model;
class Utilisateur_Progression extends Model
{
use HasCompositePrimaryKey;
protected $table = 'utilisateur_progressions';
public $timestamps = false;
public $incrementing = false;
// Clé primaire composite (ID_Utilisateur + ID_Ressource), gérée par le
// trait via compositeKeyColumns(). Eloquent impose une chaîne pour
// $primaryKey : on y met la 1re colonne pour rester conforme au contrat.
protected $primaryKey = 'ID_Utilisateur';
/**
* Colonnes composant la clé primaire composite.
*
* @return list<string>
*/
protected function compositeKeyColumns(): array
{
return ['ID_Utilisateur', 'ID_Ressource'];
}
protected $fillable = [
'ID_Utilisateur',
'ID_Ressource',
'Statut_Exploitation',
'Est_Favori',
];
protected $casts = [
'Est_Favori' => 'boolean',
];
public function utilisateur()
{
return $this->belongsTo(Utilisateur::class, 'ID_Utilisateur', 'ID_Utilisateur');
}
public function ressource()
{
return $this->belongsTo(Ressource::class, 'ID_Ressource', 'ID_Ressource');
}
}