2023-05-19 18:01:56 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
use App\Notifications\Channels\DiscordChannel;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class TestMessage extends Notification
|
|
|
|
{
|
|
|
|
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
|
|
|
|
{
|
|
|
|
return ['mail', DiscordChannel::class];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*/
|
|
|
|
public function toMail(object $notifiable): MailMessage
|
|
|
|
{
|
2023-05-23 12:32:11 +01:00
|
|
|
$smtp = [
|
|
|
|
"transport" => "smtp",
|
|
|
|
"host" => "mailpit",
|
|
|
|
"port" => 1025,
|
|
|
|
"encryption" => 'tls',
|
|
|
|
"username" => null,
|
|
|
|
"password" => null,
|
|
|
|
"timeout" => null,
|
|
|
|
"local_domain" => null,
|
|
|
|
];
|
|
|
|
config()->set('mail.mailers.smtp', $smtp);
|
|
|
|
|
|
|
|
\Illuminate\Support\Facades\Mail::mailer('smtp')
|
|
|
|
->to('ask@me.com')
|
|
|
|
->send(new \App\Mail\ExampleMail);
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-19 18:01:56 +01:00
|
|
|
return (new MailMessage)
|
|
|
|
->line('Welcome to Coolify!')
|
|
|
|
->action('Go to dashboard', url('/'))
|
|
|
|
->line('We need your attention for disk usage.');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function toDiscord(object $notifiable): string
|
|
|
|
{
|
2023-05-23 12:32:11 +01:00
|
|
|
ray('1111');
|
2023-05-19 18:01:56 +01:00
|
|
|
return 'Welcome to Coolify! We need your attention for disk usage. [Go to dashboard]('.url('/').')';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the array representation of the notification.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function toArray(object $notifiable): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|