@@ 11-48 (lines=38) @@ | ||
8 | use Spatie\UptimeMonitor\Events\InvalidSslCertificateFound as InvalidSslCertificateFoundEvent; |
|
9 | use Spatie\UptimeMonitor\Notifications\BaseNotification; |
|
10 | ||
11 | class InvalidSslCertificateFound extends BaseNotification |
|
12 | { |
|
13 | /** @var \Spatie\UptimeMonitor\Events\InvalidSslCertificateFound */ |
|
14 | protected $event; |
|
15 | ||
16 | /** |
|
17 | * Get the mail representation of the notification. |
|
18 | * |
|
19 | * @param mixed $notifiable |
|
20 | * @return \Illuminate\Notifications\Messages\MailMessage |
|
21 | */ |
|
22 | public function toMail($notifiable) |
|
23 | { |
|
24 | $mailMessage = (new MailMessage) |
|
25 | ->error() |
|
26 | ->subject("Found an invalid certificate for {$this->event->site->url}.") |
|
27 | ->line('Found an invalid certificate'); |
|
28 | ||
29 | return $mailMessage; |
|
30 | } |
|
31 | ||
32 | public function toSlack($notifiable) |
|
33 | { |
|
34 | return (new SlackMessage) |
|
35 | ->error() |
|
36 | ->content("Found an invalid ssl certificate for {$this->event->site->url}") |
|
37 | ->attachment(function (SlackAttachment $attachment) { |
|
38 | $attachment->fields($this->getSiteProperties()); |
|
39 | }); |
|
40 | } |
|
41 | ||
42 | public function setEvent(InvalidSslCertificateFoundEvent $event) |
|
43 | { |
|
44 | $this->event = $event; |
|
45 | ||
46 | return $this; |
|
47 | } |
|
48 | } |
|
49 |
@@ 12-49 (lines=38) @@ | ||
9 | use Spatie\UptimeMonitor\Models\Enums\UptimeStatus; |
|
10 | use Spatie\UptimeMonitor\Notifications\BaseNotification; |
|
11 | ||
12 | class SiteUp extends BaseNotification |
|
13 | { |
|
14 | /** @var \Spatie\UptimeMonitor\Events\SiteDown */ |
|
15 | protected $event; |
|
16 | ||
17 | /** |
|
18 | * Get the mail representation of the notification. |
|
19 | * |
|
20 | * @param mixed $notifiable |
|
21 | * @return \Illuminate\Notifications\Messages\MailMessage |
|
22 | */ |
|
23 | public function toMail($notifiable) |
|
24 | { |
|
25 | $mailMessage = (new MailMessage) |
|
26 | ->success() |
|
27 | ->subject("Site {$this->event->site->url} is up.") |
|
28 | ->line('Site is up'); |
|
29 | ||
30 | return $mailMessage; |
|
31 | } |
|
32 | ||
33 | public function toSlack($notifiable) |
|
34 | { |
|
35 | return (new SlackMessage) |
|
36 | ->success() |
|
37 | ->content("Site {$this->event->site->url} is up") |
|
38 | ->attachment(function (SlackAttachment $attachment) { |
|
39 | $attachment->fields($this->getSiteProperties()); |
|
40 | }); |
|
41 | } |
|
42 | ||
43 | public function setEvent(SiteUpEvent $event) |
|
44 | { |
|
45 | $this->event = $event; |
|
46 | ||
47 | return $this; |
|
48 | } |
|
49 | } |
|
50 |
@@ 12-49 (lines=38) @@ | ||
9 | use Spatie\UptimeMonitor\Models\Enums\UptimeStatus; |
|
10 | use Spatie\UptimeMonitor\Notifications\BaseNotification; |
|
11 | ||
12 | class ValidSslCertificateFound extends BaseNotification |
|
13 | { |
|
14 | /** @var \Spatie\UptimeMonitor\Events\ValidSslCertificateFound */ |
|
15 | protected $event; |
|
16 | ||
17 | /** |
|
18 | * Get the mail representation of the notification. |
|
19 | * |
|
20 | * @param mixed $notifiable |
|
21 | * @return \Illuminate\Notifications\Messages\MailMessage |
|
22 | */ |
|
23 | public function toMail($notifiable) |
|
24 | { |
|
25 | $mailMessage = (new MailMessage) |
|
26 | ->success() |
|
27 | ->subject("Found a valid certificate for {$this->event->site->url}.") |
|
28 | ->line('Found a valid certificate'); |
|
29 | ||
30 | return $mailMessage; |
|
31 | } |
|
32 | ||
33 | public function toSlack($notifiable) |
|
34 | { |
|
35 | return (new SlackMessage) |
|
36 | ->success() |
|
37 | ->content("Found a valid ssl certificate for {$this->event->site->url}") |
|
38 | ->attachment(function (SlackAttachment $attachment) { |
|
39 | $attachment->fields($this->getSiteProperties()); |
|
40 | }); |
|
41 | } |
|
42 | ||
43 | public function setEvent(ValidSslCertificateFoundEvent $event) |
|
44 | { |
|
45 | $this->event = $event; |
|
46 | ||
47 | return $this; |
|
48 | } |
|
49 | } |
|
50 |