some progress

This commit is contained in:
Doar Mihai
2026-01-24 12:16:10 +02:00
parent 3665a1d5a3
commit 612cc097f8
51 changed files with 8089 additions and 470 deletions
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Carbon\Carbon;
class Domain extends Model
{
protected $fillable = [
'site_id',
'domain',
'expires_at',
'last_checked_at',
'is_active',
];
protected $casts = [
'expires_at' => 'datetime',
'last_checked_at' => 'datetime',
'is_active' => 'boolean',
];
public function site(): BelongsTo
{
return $this->belongsTo(Site::class);
}
/**
* Check if domain is expiring soon (within 30 days)
*/
public function isExpiringSoon(): bool
{
if (!$this->expires_at) {
return false;
}
return $this->expires_at->lte(Carbon::now()->addDays(30));
}
/**
* Check if domain has expired
*/
public function isExpired(): bool
{
if (!$this->expires_at) {
return false;
}
return $this->expires_at->lte(Carbon::now());
}
/**
* Get days until expiration
*/
public function daysUntilExpiration(): ?int
{
if (!$this->expires_at) {
return null;
}
return Carbon::now()->diffInDays($this->expires_at, false);
}
}