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
+44
View File
@@ -24,6 +24,16 @@ class User extends Authenticatable
'email',
'password',
'notification_preferences',
'notification_channels',
'slack_webhook_url',
'telegram_chat_id',
'discord_webhook_url',
'teams_webhook_url',
'google_chat_webhook_url',
'webhook_url',
'sms_phone_number',
'opsgenie_api_key',
'pagerduty_integration_key',
];
/**
@@ -47,9 +57,43 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
'password' => 'hashed',
'notification_preferences' => 'array',
'notification_channels' => 'array',
];
}
/**
* Get enabled notification channels for a specific alert type
*/
public function getNotificationChannelsFor(string $alertType): array
{
$channels = $this->notification_channels ?? [];
return $channels[$alertType] ?? ['database'];
}
/**
* Route notification for Slack
*/
public function routeNotificationForSlack(): ?string
{
return $this->slack_webhook_url;
}
/**
* Route notification for Telegram
*/
public function routeNotificationForTelegram(): ?string
{
return $this->telegram_chat_id;
}
/**
* Route notification for Discord
*/
public function routeNotificationForDiscord(): ?string
{
return $this->discord_webhook_url;
}
public function sites(): HasMany
{
return $this->hasMany(Site::class);