lasthourcloud/app/Notifications/Database/DailyBackup.php

51 lines
1.2 KiB
PHP
Raw Normal View History

<?php
namespace App\Notifications\Database;
use App\Notifications\Channels\DiscordChannel;
use App\Notifications\Channels\TelegramChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Channels\MailChannel;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class DailyBackup extends Notification implements ShouldQueue
{
use Queueable;
public $tries = 1;
2024-06-19 06:59:46 +00:00
public function __construct(public $databases) {}
public function via(object $notifiable): array
{
return [DiscordChannel::class, TelegramChannel::class, MailChannel::class];
}
public function toMail(): MailMessage
{
2024-07-24 12:27:21 +00:00
$mail = new MailMessage;
2024-06-10 20:43:34 +00:00
$mail->subject('Coolify: Daily backup statuses');
$mail->view('emails.daily-backup', [
'databases' => $this->databases,
]);
2024-06-10 20:43:34 +00:00
return $mail;
}
public function toDiscord(): string
{
2024-06-10 20:43:34 +00:00
return 'Coolify: Daily backup statuses';
}
2024-06-10 20:43:34 +00:00
public function toTelegram(): array
{
2024-06-10 20:43:34 +00:00
$message = 'Coolify: Daily backup statuses';
return [
2024-06-10 20:43:34 +00:00
'message' => $message,
];
}
}