lasthourcloud/app/Notifications/Test.php

52 lines
1.2 KiB
PHP
Raw Normal View History

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