2026-10-13 12:44:00 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
|
|
|
|
|
class RenduDevoir extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'rendus_devoirs';
|
|
|
|
|
|
2026-10-14 09:52:15 +02:00
|
|
|
protected $fillable = ['devoir_id', 'eleve_id', 'reponse', 'fichier_chemin', 'fichier_nom_original', 'fichier_taille_octets', 'note', 'rendu_a'];
|
2026-10-13 12:44:00 +02:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
2026-10-14 09:52:15 +02:00
|
|
|
|
|
|
|
|
public function aUnFichier(): bool
|
|
|
|
|
{
|
|
|
|
|
return $this->fichier_chemin !== null;
|
|
|
|
|
}
|
2026-10-13 12:44:00 +02:00
|
|
|
}
|