2023-05-19 17:01:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
2023-06-01 10:15:33 +00:00
|
|
|
use App\Notifications\Channels\EmailChannel;
|
2023-05-19 17:01:56 +00:00
|
|
|
use App\Notifications\Channels\DiscordChannel;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
2023-06-01 10:15:33 +00:00
|
|
|
class TestNotification extends Notification implements ShouldQueue
|
2023-05-19 17:01:56 +00:00
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @return array<int, string>
|
|
|
|
*/
|
|
|
|
public function via(object $notifiable): array
|
|
|
|
{
|
2023-05-25 16:27:52 +00:00
|
|
|
$channels = [];
|
2023-06-01 11:24:20 +00:00
|
|
|
$notifiable->extra_attributes?->get('smtp_active') && $channels[] = EmailChannel::class;
|
|
|
|
$notifiable->extra_attributes?->get('discord_active') && $channels[] = DiscordChannel::class;
|
2023-05-25 16:27:52 +00:00
|
|
|
return $channels;
|
2023-05-19 17:01:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*/
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
|
|
{
|
|
|
|
return (new MailMessage)
|
2023-06-01 10:15:33 +00:00
|
|
|
->subject('Coolify Test Notification')
|
|
|
|
->line('Congratulations!')
|
|
|
|
->line('You have successfully received a test Email notification from Coolify. 🥳');
|
2023-05-19 17:01:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function toDiscord(object $notifiable): string
|
|
|
|
{
|
2023-06-01 10:15:33 +00:00
|
|
|
return 'You have successfully received a test Discord notification from Coolify. 🥳 [Go to your dashboard](' . url('/') . ')';
|
2023-05-19 17:01:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function toArray(object $notifiable): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|