feat: use new notification event names

This commit is contained in:
peaklabs-dev
2024-12-09 16:57:15 +01:00
parent bc726ddd6e
commit b6500142c4
12 changed files with 75 additions and 150 deletions

View File

@@ -5,8 +5,8 @@ namespace App\Notifications\Container;
use App\Models\Server;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
use Illuminate\Notifications\Messages\MailMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Notifications\Messages\MailMessage;
class ContainerRestarted extends CustomEmailNotification
{
@@ -17,7 +17,7 @@ class ContainerRestarted extends CustomEmailNotification
public function via(object $notifiable): array
{
return setNotificationChannels($notifiable, 'status_changes');
return $notifiable->getEnabledChannels('status_change');
}
public function toMail(): MailMessage
@@ -42,7 +42,7 @@ class ContainerRestarted extends CustomEmailNotification
);
if ($this->url) {
$message->addField('Resource', '[Link](' . $this->url . ')');
$message->addField('Resource', '[Link]('.$this->url.')');
}
return $message;
@@ -70,7 +70,7 @@ class ContainerRestarted extends CustomEmailNotification
public function toSlack(): SlackMessage
{
$title = "Resource restarted";
$title = 'Resource restarted';
$description = "A resource ({$this->name}) has been restarted automatically on {$this->server->name}";
if ($this->url) {

View File

@@ -5,8 +5,8 @@ namespace App\Notifications\Container;
use App\Models\Server;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
use Illuminate\Notifications\Messages\MailMessage;
use App\Notifications\Dto\SlackMessage;
use Illuminate\Notifications\Messages\MailMessage;
class ContainerStopped extends CustomEmailNotification
{
@@ -17,7 +17,7 @@ class ContainerStopped extends CustomEmailNotification
public function via(object $notifiable): array
{
return setNotificationChannels($notifiable, 'status_changes');
return $notifiable->getEnabledChannels('status_change');
}
public function toMail(): MailMessage
@@ -42,7 +42,7 @@ class ContainerStopped extends CustomEmailNotification
);
if ($this->url) {
$message->addField('Resource', '[Link](' . $this->url . ')');
$message->addField('Resource', '[Link]('.$this->url.')');
}
return $message;
@@ -70,7 +70,7 @@ class ContainerStopped extends CustomEmailNotification
public function toSlack(): SlackMessage
{
$title = "Resource stopped";
$title = 'Resource stopped';
$description = "A resource ({$this->name}) has been stopped unexpectedly on {$this->server->name}";
if ($this->url) {