coolify/app/Notifications/Test.php

54 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2023-07-28 10:55:26 +02:00
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
2023-07-28 10:55:26 +02:00
class Test extends Notification implements ShouldQueue
{
use Queueable;
2023-09-08 16:53:19 +02:00
public $tries = 5;
2024-06-10 22:43:34 +02:00
2024-06-19 08:59:46 +02:00
public function __construct(public ?string $emails = null) {}
2023-07-28 10:55:26 +02:00
public function via(object $notifiable): array
{
2023-09-06 14:31:38 +02:00
return setNotificationChannels($notifiable, 'test');
}
2023-06-12 12:00:01 +02:00
public function toMail(): MailMessage
{
2023-06-19 14:31:42 +02:00
$mail = new MailMessage();
2024-06-10 22:43:34 +02:00
$mail->subject('Coolify: Test Email');
2023-06-19 14:31:42 +02:00
$mail->view('emails.test');
2024-06-10 22:43:34 +02:00
2023-06-19 14:31:42 +02:00
return $mail;
}
2023-06-12 12:00:01 +02:00
public function toDiscord(): string
{
2023-10-10 13:10:43 +02:00
$message = 'Coolify: This is a test Discord notification from Coolify.';
2023-06-21 10:48:43 +02:00
$message .= "\n\n";
2024-06-10 22:43:34 +02:00
$message .= '[Go to your dashboard]('.base_url().')';
2023-06-21 10:48:43 +02:00
return $message;
}
2024-06-10 22:43:34 +02:00
2023-09-06 14:31:38 +02:00
public function toTelegram(): array
{
return [
2024-06-10 22:43:34 +02:00
'message' => 'Coolify: This is a test Telegram notification from Coolify.',
'buttons' => [
2023-09-06 14:31:38 +02:00
[
2024-06-10 22:43:34 +02:00
'text' => 'Go to your dashboard',
'url' => base_url(),
],
2023-09-06 14:31:38 +02:00
],
];
}
}