Files
pterodactyl-panel/app/Notifications/AddedToServer.php
T

49 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
namespace Pterodactyl\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
2026-10-05 18:10:18 -04:00
use Illuminate\Notifications\Notification;
class AddedToServer extends Notification implements ShouldQueue
{
use Queueable;
/**
* Create a new notification instance.
2026-10-05 18:10:18 -04:00
*
* @param array{user: string, name: string, uuidShort: string} $server
*/
2026-10-05 18:10:18 -04:00
public function __construct(
public readonly array $server,
) {
$this->afterCommit();
}
/**
* Get the notification's delivery channels.
2026-10-05 18:10:18 -04:00
*
* @return list<string>
*/
2022-10-14 10:59:20 -06:00
public function via(): array
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*/
2022-10-14 10:59:20 -06:00
public function toMail(): MailMessage
{
2026-10-05 18:10:18 -04:00
return (new MailMessage)
->greeting('Hello '.$this->server['user'].'!')
->line('You have been added as a subuser for the following server, allowing you certain control over the server.')
2026-10-05 18:10:18 -04:00
->line('Server Name: '.$this->server['name'])
->action('Visit Server', url('/server/'.$this->server['uuidShort']));
}
}