Files
coolify/app/Models/SlackNotificationSettings.php
033f0c84da v4.7 (#12478)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Co-authored-by: Aditya Tripathi <aditya@climactic.co>
2026-11-06 14:25:02 +01:00

84 lines
2.6 KiB
PHP

<?php
namespace App\Models;
use App\Traits\TracksDeliveryFailures;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class SlackNotificationSettings extends Model
{
use Notifiable, TracksDeliveryFailures;
public $timestamps = false;
protected $fillable = [
'team_id',
'slack_enabled',
'slack_webhook_url',
'deployment_success_slack_notifications',
'deployment_failure_slack_notifications',
'status_change_slack_notifications',
'restart_limit_reached_slack_notifications',
'backup_success_slack_notifications',
'backup_failure_slack_notifications',
'scheduled_task_success_slack_notifications',
'scheduled_task_failure_slack_notifications',
'docker_cleanup_success_slack_notifications',
'docker_cleanup_failure_slack_notifications',
'server_disk_usage_slack_notifications',
'server_reachable_slack_notifications',
'server_unreachable_slack_notifications',
'server_patch_slack_notifications',
'traefik_outdated_slack_notifications',
'image_vulnerabilities_slack_notifications',
];
protected $hidden = [
'slack_webhook_url',
];
protected $casts = [
'slack_enabled' => 'boolean',
'slack_webhook_url' => 'encrypted',
'deployment_success_slack_notifications' => 'boolean',
'deployment_failure_slack_notifications' => 'boolean',
'status_change_slack_notifications' => 'boolean',
'restart_limit_reached_slack_notifications' => 'boolean',
'backup_success_slack_notifications' => 'boolean',
'backup_failure_slack_notifications' => 'boolean',
'scheduled_task_success_slack_notifications' => 'boolean',
'scheduled_task_failure_slack_notifications' => 'boolean',
'docker_cleanup_slack_notifications' => 'boolean',
'server_disk_usage_slack_notifications' => 'boolean',
'server_reachable_slack_notifications' => 'boolean',
'server_unreachable_slack_notifications' => 'boolean',
'server_patch_slack_notifications' => 'boolean',
'traefik_outdated_slack_notifications' => 'boolean',
'image_vulnerabilities_slack_notifications' => 'boolean',
];
public function team()
{
return $this->belongsTo(Team::class);
}
public function isEnabled()
{
return $this->slack_enabled;
}
public function notificationChannelName(): string
{
return 'Slack';
}
protected function disableNotificationChannel(): void
{
$this->slack_enabled = false;
}
}