'date', 'date_fin_garantie' => 'date', ]; public function commune(): BelongsTo { return $this->belongsTo(Commune::class); } public function commande(): BelongsTo { return $this->belongsTo(Commande::class); } public function getEstSousGarantieAttribute(): bool { if (!$this->date_fin_garantie) { return false; } return Carbon::now()->isBefore($this->date_fin_garantie); } public function getGarantieExpireeAttribute(): bool { if (!$this->date_fin_garantie) { return false; } return Carbon::now()->isAfter($this->date_fin_garantie); } public function getEstProcheExpirationGarantieAttribute(): bool { if (!$this->date_fin_garantie || $this->garantie_expiree) { return false; } return Carbon::now()->diffInDays($this->date_fin_garantie, false) <= 30; } }