2023-08-16 14:03:30 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Notifications\Internal;
|
|
|
|
|
|
2024-10-01 19:42:13 +00:00
|
|
|
use App\Notifications\Dto\DiscordMessage;
|
2024-12-11 14:54:11 +00:00
|
|
|
use App\Notifications\Dto\PushoverMessage;
|
2024-11-12 21:37:55 +00:00
|
|
|
use App\Notifications\Dto\SlackMessage;
|
2023-08-16 14:03:30 +00:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
|
|
class GeneralNotification extends Notification implements ShouldQueue
|
|
|
|
|
{
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
2023-09-28 09:33:16 +00:00
|
|
|
public $tries = 1;
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2024-11-12 21:37:55 +00:00
|
|
|
public function __construct(public string $message)
|
|
|
|
|
{
|
2024-11-22 10:16:01 +00:00
|
|
|
$this->onQueue('high');
|
2024-11-12 21:37:55 +00:00
|
|
|
}
|
2023-08-16 14:03:30 +00:00
|
|
|
|
|
|
|
|
public function via(object $notifiable): array
|
|
|
|
|
{
|
2024-12-09 16:00:07 +00:00
|
|
|
return $notifiable->getEnabledChannels('general');
|
2023-08-16 14:03:30 +00:00
|
|
|
}
|
|
|
|
|
|
2024-10-01 19:42:13 +00:00
|
|
|
public function toDiscord(): DiscordMessage
|
2023-08-16 14:03:30 +00:00
|
|
|
{
|
2024-10-01 19:42:13 +00:00
|
|
|
return new DiscordMessage(
|
|
|
|
|
title: 'Coolify: General Notification',
|
|
|
|
|
description: $this->message,
|
|
|
|
|
color: DiscordMessage::infoColor(),
|
|
|
|
|
);
|
2023-08-16 14:03:30 +00:00
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-09-06 12:31:38 +00:00
|
|
|
public function toTelegram(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2024-06-10 20:43:34 +00:00
|
|
|
'message' => $this->message,
|
2023-09-06 12:31:38 +00:00
|
|
|
];
|
|
|
|
|
}
|
2024-11-12 21:37:55 +00:00
|
|
|
|
2024-12-11 14:54:11 +00:00
|
|
|
public function toPushover(): PushoverMessage
|
|
|
|
|
{
|
|
|
|
|
return new PushoverMessage(
|
|
|
|
|
title: 'General Notification',
|
|
|
|
|
level: 'info',
|
|
|
|
|
message: $this->message,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-12 21:37:55 +00:00
|
|
|
public function toSlack(): SlackMessage
|
|
|
|
|
{
|
|
|
|
|
return new SlackMessage(
|
|
|
|
|
title: 'Coolify: General Notification',
|
|
|
|
|
description: $this->message,
|
|
|
|
|
color: SlackMessage::infoColor(),
|
|
|
|
|
);
|
|
|
|
|
}
|
2023-08-16 14:03:30 +00:00
|
|
|
}
|