diff --git a/src/Notifications/Notifications/CertificateExpiresSoon.php b/src/Notifications/Notifications/CertificateExpiresSoon.php index f99eb91f..f13d3ed1 100644 --- a/src/Notifications/Notifications/CertificateExpiresSoon.php +++ b/src/Notifications/Notifications/CertificateExpiresSoon.php @@ -57,6 +57,6 @@ public function setEvent(SoonExpiringSslCertificateFoundEvent $event) protected function getMessageText(): string { - return "SSL certificate for {$this->event->monitor->url} expires soon"; + return "SSL certificate for {$this->getMonitor()->url} expires soon"; } } diff --git a/src/Notifications/Notifications/UptimeCheckFailed.php b/src/Notifications/Notifications/UptimeCheckFailed.php index 7743da7c..af43a794 100644 --- a/src/Notifications/Notifications/UptimeCheckFailed.php +++ b/src/Notifications/Notifications/UptimeCheckFailed.php @@ -57,7 +57,7 @@ public function getMonitorProperties($extraProperties = []): array $extraProperties = [ $since => $date, - 'Failure reason' => $this->event->monitor->uptime_check_failure_reason, + 'Failure reason' => $this->getMonitor()->uptime_check_failure_reason, ]; return parent::getMonitorProperties($extraProperties); @@ -65,7 +65,7 @@ public function getMonitorProperties($extraProperties = []): array public function isStillRelevant(): bool { - return $this->event->monitor->uptime_status == UptimeStatus::DOWN; + return $this->getMonitor()->uptime_status == UptimeStatus::DOWN; } public function setEvent(MonitorFailedEvent $event) @@ -77,6 +77,6 @@ public function setEvent(MonitorFailedEvent $event) protected function getMessageText(): string { - return "{$this->event->monitor->url} seems down"; + return "{$this->getMonitor()->url} seems down"; } } diff --git a/src/Notifications/Notifications/UptimeCheckRecovered.php b/src/Notifications/Notifications/UptimeCheckRecovered.php index 4d1b7eab..988d8f3d 100644 --- a/src/Notifications/Notifications/UptimeCheckRecovered.php +++ b/src/Notifications/Notifications/UptimeCheckRecovered.php @@ -60,7 +60,7 @@ public function getMonitorProperties($extraProperties = []): array public function isStillRelevant(): bool { - return $this->event->monitor->uptime_status == UptimeStatus::UP; + return $this->getMonitor()->uptime_status == UptimeStatus::UP; } public function setEvent(MonitorRecoveredEvent $event) @@ -72,6 +72,6 @@ public function setEvent(MonitorRecoveredEvent $event) public function getMessageText(): string { - return "{$this->event->monitor->url} has recovered after {$this->event->downtimePeriod->duration()}"; + return "{$this->getMonitor()->url} has recovered after {$this->event->downtimePeriod->duration()}"; } } diff --git a/src/Notifications/Notifications/UptimeCheckSucceeded.php b/src/Notifications/Notifications/UptimeCheckSucceeded.php index b36b479b..6802da11 100644 --- a/src/Notifications/Notifications/UptimeCheckSucceeded.php +++ b/src/Notifications/Notifications/UptimeCheckSucceeded.php @@ -49,7 +49,7 @@ public function toSlack($notifiable) public function isStillRelevant(): bool { - return $this->event->monitor->uptime_status != UptimeStatus::DOWN; + return $this->getMonitor()->uptime_status != UptimeStatus::DOWN; } public function setEvent(MonitorSucceededEvent $event) @@ -61,6 +61,6 @@ public function setEvent(MonitorSucceededEvent $event) public function getMessageText(): string { - return "{$this->event->monitor->url} is up"; + return "{$this->getMonitor()->url} is up"; } }