Merge pull request #6837 from coollabsio/andrasbacsai/custom-webhooks

feat: add custom webhook notification support
This commit is contained in:
Andras Bacsai authored and GitHub committed 2025-10-12 10:57:47 +02:00
commit 635af44539
29 files changed
+889

No files matched your search

+6
View File
@@ -54,6 +54,7 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
$team->slackNotificationSettings()->create();
$team->telegramNotificationSettings()->create();
$team->pushoverNotificationSettings()->create();
$team->webhookNotificationSettings()->create();
});
static::saving(function ($team) {
@@ -312,4 +313,9 @@ class Team extends Model implements SendsDiscord, SendsEmail, SendsPushover, Sen
{
return $this->hasOne(PushoverNotificationSettings::class);
}
public function webhookNotificationSettings()
{
return $this->hasOne(WebhookNotificationSettings::class);
}
}
@@ -0,0 +1,64 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class WebhookNotificationSettings extends Model
{
use Notifiable;
public $timestamps = false;
protected $fillable = [
'team_id',
'webhook_enabled',
'webhook_url',
'deployment_success_webhook_notifications',
'deployment_failure_webhook_notifications',
'status_change_webhook_notifications',
'backup_success_webhook_notifications',
'backup_failure_webhook_notifications',
'scheduled_task_success_webhook_notifications',
'scheduled_task_failure_webhook_notifications',
'docker_cleanup_webhook_notifications',
'server_disk_usage_webhook_notifications',
'server_reachable_webhook_notifications',
'server_unreachable_webhook_notifications',
'server_patch_webhook_notifications',
];
protected function casts(): array
{
return [
'webhook_enabled' => 'boolean',
'webhook_url' => 'encrypted',
'deployment_success_webhook_notifications' => 'boolean',
'deployment_failure_webhook_notifications' => 'boolean',
'status_change_webhook_notifications' => 'boolean',
'backup_success_webhook_notifications' => 'boolean',
'backup_failure_webhook_notifications' => 'boolean',
'scheduled_task_success_webhook_notifications' => 'boolean',
'scheduled_task_failure_webhook_notifications' => 'boolean',
'docker_cleanup_webhook_notifications' => 'boolean',
'server_disk_usage_webhook_notifications' => 'boolean',
'server_reachable_webhook_notifications' => 'boolean',
'server_unreachable_webhook_notifications' => 'boolean',
'server_patch_webhook_notifications' => 'boolean',
];
}
public function team()
{
return $this->belongsTo(Team::class);
}
public function isEnabled()
{
return $this->webhook_enabled;
}
}