Initial commit with contrats and domaines modules

This commit is contained in:
mrKamoo
2026-04-08 18:07:08 +02:00
commit 092a6a0484
191 changed files with 24639 additions and 0 deletions

42
app/Models/Domaine.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Domaine extends Model
{
use HasFactory;
protected $fillable = [
'nom',
'date_echeance',
'prestataire',
'hebergeur',
];
protected $casts = [
'date_echeance' => 'date',
];
// Un domaine est considéré "proche d'expiration" si l'échéance est dans moins de 30 jours
public function getEstProcheEcheanceAttribute(): bool
{
if (!$this->date_echeance) {
return false;
}
return Carbon::now()->diffInDays($this->date_echeance, false) <= 30;
}
public function getEstEnRetardAttribute(): bool
{
if (!$this->date_echeance) {
return false;
}
return Carbon::now()->isAfter($this->date_echeance);
}
}