Add in-app notifications for domain expiration alerts

Implemented logic to create in-app (bell icon) notifications for users when domains are expiring or have expired. The notification recipients are determined by the user isolation mode: in isolated mode, only the domain owner (or group owner) is notified; in shared mode, all active users receive the notification. This applies to both the main check and the retry queue.
This commit is contained in:
Hosteroid
2025-12-18 14:37:15 +02:00
parent 1e98b8a047
commit 24d5479dcf
2 changed files with 263 additions and 45 deletions

View File

@@ -153,12 +153,15 @@ class Notification extends Model
*/
public function createNotification(int $userId, string $type, string $title, string $message, ?int $domainId = null): int
{
// Use PHP's current time (respects timezone setting) instead of database's CURRENT_TIMESTAMP
// This ensures timezone consistency between cron job and web interface
return $this->create([
'user_id' => $userId,
'type' => $type,
'title' => $title,
'message' => $message,
'domain_id' => $domainId
'domain_id' => $domainId,
'created_at' => date('Y-m-d H:i:s') // Use PHP timezone, not database timezone
]);
}