|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace App\Livewire; |
| 4 | + |
| 5 | +use App\Settings\NotificationSettings; |
| 6 | +use Livewire\Attributes\Computed; |
| 7 | +use Livewire\Component; |
| 8 | + |
| 9 | +class DeprecatedNotificationChannelsBanner extends Component |
| 10 | +{ |
| 11 | + #[Computed] |
| 12 | + public function hasDeprecatedChannels(): bool |
| 13 | + { |
| 14 | + $settings = app(NotificationSettings::class); |
| 15 | + |
| 16 | + return $settings->discord_enabled |
| 17 | + || $settings->gotify_enabled |
| 18 | + || $settings->healthcheck_enabled |
| 19 | + || $settings->ntfy_enabled |
| 20 | + || $settings->pushover_enabled |
| 21 | + || $settings->slack_enabled |
| 22 | + || $settings->telegram_enabled; |
| 23 | + } |
| 24 | + |
| 25 | + #[Computed] |
| 26 | + public function deprecatedChannelsList(): array |
| 27 | + { |
| 28 | + $settings = app(NotificationSettings::class); |
| 29 | + $channels = []; |
| 30 | + |
| 31 | + if ($settings->discord_enabled) { |
| 32 | + $channels[] = 'Discord'; |
| 33 | + } |
| 34 | + |
| 35 | + if ($settings->gotify_enabled) { |
| 36 | + $channels[] = 'Gotify'; |
| 37 | + } |
| 38 | + |
| 39 | + if ($settings->healthcheck_enabled) { |
| 40 | + $channels[] = 'Healthchecks'; |
| 41 | + } |
| 42 | + |
| 43 | + if ($settings->ntfy_enabled) { |
| 44 | + $channels[] = 'Ntfy'; |
| 45 | + } |
| 46 | + |
| 47 | + if ($settings->pushover_enabled) { |
| 48 | + $channels[] = 'Pushover'; |
| 49 | + } |
| 50 | + |
| 51 | + if ($settings->slack_enabled) { |
| 52 | + $channels[] = 'Slack'; |
| 53 | + } |
| 54 | + |
| 55 | + if ($settings->telegram_enabled) { |
| 56 | + $channels[] = 'Telegram'; |
| 57 | + } |
| 58 | + |
| 59 | + return $channels; |
| 60 | + } |
| 61 | + |
| 62 | + public function render() |
| 63 | + { |
| 64 | + return view('livewire.deprecated-notification-channels-banner'); |
| 65 | + } |
| 66 | +} |
0 commit comments