some progress
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user