ajoute les devoirs maison (chantier vrai cockpit, étape 3) : rendu en texte libre, suivi des rendus, notation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
bd74eaf20f
commit
33531de44d
17 changed files with 582 additions and 2 deletions
|
|
@ -73,6 +73,12 @@ class Classe extends Model
|
|||
return $this->hasMany(Quiz::class)->latest();
|
||||
}
|
||||
|
||||
/** @return HasMany<Devoir, $this> */
|
||||
public function devoirs(): HasMany
|
||||
{
|
||||
return $this->hasMany(Devoir::class)->latest('echeance');
|
||||
}
|
||||
|
||||
public function estArchivee(): bool
|
||||
{
|
||||
return $this->archivee_a !== null;
|
||||
|
|
|
|||
37
portail/app/Models/Devoir.php
Normal file
37
portail/app/Models/Devoir.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* Devoir maison (chantier « vrai cockpit », étape 3 — 2026-10-13) : rendu en
|
||||
* texte libre, une seule fois par élève, avant l'échéance.
|
||||
*/
|
||||
class Devoir extends Model
|
||||
{
|
||||
protected $fillable = ['classe_id', 'titre', 'consigne', 'echeance'];
|
||||
|
||||
protected $casts = [
|
||||
'echeance' => 'datetime',
|
||||
];
|
||||
|
||||
/** @return BelongsTo<Classe, $this> */
|
||||
public function classe(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Classe::class);
|
||||
}
|
||||
|
||||
/** @return HasMany<RenduDevoir, $this> */
|
||||
public function rendus(): HasMany
|
||||
{
|
||||
return $this->hasMany(RenduDevoir::class);
|
||||
}
|
||||
|
||||
public function echeanceDepassee(): bool
|
||||
{
|
||||
return $this->echeance->isPast();
|
||||
}
|
||||
}
|
||||
30
portail/app/Models/RenduDevoir.php
Normal file
30
portail/app/Models/RenduDevoir.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class RenduDevoir extends Model
|
||||
{
|
||||
protected $table = 'rendus_devoirs';
|
||||
|
||||
protected $fillable = ['devoir_id', 'eleve_id', 'reponse', 'note', 'rendu_a'];
|
||||
|
||||
protected $casts = [
|
||||
'rendu_a' => 'datetime',
|
||||
'note' => 'integer',
|
||||
];
|
||||
|
||||
/** @return BelongsTo<Devoir, $this> */
|
||||
public function devoir(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Devoir::class);
|
||||
}
|
||||
|
||||
/** @return BelongsTo<Eleve, $this> */
|
||||
public function eleve(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Eleve::class);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue