diff --git a/app/Listeners/SpeedtestCompletedListener.php b/app/Listeners/SpeedtestCompletedListener.php index e5ab70681..d9a837c28 100644 --- a/app/Listeners/SpeedtestCompletedListener.php +++ b/app/Listeners/SpeedtestCompletedListener.php @@ -4,6 +4,7 @@ use App\Events\ResultCreated; use App\Mail\SpeedtestCompletedMail; +use App\Settings\GeneralSettings; use App\Settings\NotificationSettings; use App\Telegram\TelegramNotification; use Filament\Notifications\Notification; @@ -11,6 +12,8 @@ class SpeedtestCompletedListener { + public $generalSettings; + public $notificationSettings; /** @@ -20,6 +23,8 @@ class SpeedtestCompletedListener */ public function __construct() { + $this->generalSettings = new (GeneralSettings::class); + $this->notificationSettings = new (NotificationSettings::class); } @@ -59,6 +64,7 @@ public function handle(ResultCreated $event) $message = view('telegram.speedtest-completed', [ 'id' => $event->result->id, + 'site_name' => $this->generalSettings->site_name, 'ping' => $ping_value, 'download' => $download_value, 'upload' => $upload_value, diff --git a/app/Listeners/Threshold/AbsoluteListener.php b/app/Listeners/Threshold/AbsoluteListener.php index 259b9bd63..4bf5dd0fb 100644 --- a/app/Listeners/Threshold/AbsoluteListener.php +++ b/app/Listeners/Threshold/AbsoluteListener.php @@ -4,6 +4,7 @@ use App\Events\ResultCreated; use App\Mail\Threshold\AbsoluteMail; +use App\Settings\GeneralSettings; use App\Settings\NotificationSettings; use App\Settings\ThresholdSettings; use App\Telegram\TelegramNotification; @@ -14,6 +15,8 @@ class AbsoluteListener implements ShouldQueue { + public $generalSettings; + public $notificationSettings; public $thresholdSettings; @@ -25,6 +28,8 @@ class AbsoluteListener implements ShouldQueue */ public function __construct() { + $this->generalSettings = new (GeneralSettings::class); + $this->notificationSettings = new (NotificationSettings::class); $this->thresholdSettings = new (ThresholdSettings::class); @@ -205,6 +210,7 @@ protected function telegramChannel(ResultCreated $event) $message = view('telegram.threshold.absolute', [ 'id' => $event->result->id, 'url' => url('/admin/results'), + 'site_name' => $this->generalSettings->site_name, 'metrics' => $failedThresholds, ])->render(); diff --git a/resources/views/telegram/speedtest-completed.blade.php b/resources/views/telegram/speedtest-completed.blade.php index 481b35363..d5e0af62e 100644 --- a/resources/views/telegram/speedtest-completed.blade.php +++ b/resources/views/telegram/speedtest-completed.blade.php @@ -1,4 +1,7 @@ -Speedtest #{{ $id }} +{{ $site_name }} - Result *#{{ $id }}* + +*Speedtest Completed* +----- Ping: *{{ $ping }}* Download: *{{ $download }}* Upload: *{{ $upload }}* \ No newline at end of file diff --git a/resources/views/telegram/threshold/absolute.blade.php b/resources/views/telegram/threshold/absolute.blade.php index 8d8e95c56..ecf23e1ab 100644 --- a/resources/views/telegram/threshold/absolute.blade.php +++ b/resources/views/telegram/threshold/absolute.blade.php @@ -1,5 +1,7 @@ -Speedtest Result *#{{ $id }}* -*Absolute Threshold Failed* +{{ $site_name }} - Result *#{{ $id }}* + +*Absolute Threshold(s) Failed* +----- @foreach ($metrics as $item) -Threshold *{{ $item['name'] }}* {{ $item['threshold'] }}: *{{ $item['value'] }}* +Threshold *{{ $item['name'] }}* {{ $item['threshold'] }}: *{{ $item['value'] }}* @endforeach