2016-09-05 12:00:56 -04:00
|
|
|
<?php
|
2016-12-07 22:46:38 +00:00
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2016-09-05 12:00:56 -04:00
|
|
|
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;
|
|
|
|
|
use Pterodactyl\Models\User;
|
2016-09-05 12:00:56 -04:00
|
|
|
|
|
|
|
|
class AccountCreated extends Notification implements ShouldQueue
|
|
|
|
|
{
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a new notification instance.
|
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function __construct(public User $user, public ?string $token = null)
|
2016-09-05 12:00:56 -04:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
$this->afterCommit();
|
2016-09-05 12:00:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the notification's delivery channels.
|
2026-10-05 18:10:18 -04:00
|
|
|
*
|
|
|
|
|
* @return list<string>
|
2016-09-05 12:00:56 -04:00
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function via(): array
|
2016-09-05 12:00:56 -04:00
|
|
|
{
|
2016-10-14 15:58:52 -04:00
|
|
|
return ['mail'];
|
2016-09-05 12:00:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
|
*/
|
2022-10-14 10:59:20 -06:00
|
|
|
public function toMail(): MailMessage
|
2016-09-05 12:00:56 -04:00
|
|
|
{
|
2026-10-05 18:10:18 -04:00
|
|
|
$message = (new MailMessage)
|
|
|
|
|
->greeting('Hello '.$this->user->name.'!')
|
2026-10-11 16:09:53 -04:00
|
|
|
->line('You are receiving this email because an account has been created for you on '.config()->string('app.name').'.')
|
2026-10-05 18:10:18 -04:00
|
|
|
->line('Username: '.$this->user->username)
|
|
|
|
|
->line('Email: '.$this->user->email);
|
|
|
|
|
|
|
|
|
|
if (($this->token) !== null) {
|
|
|
|
|
return $message->action('Setup Your Account', url('/auth/password/reset/'.$this->token.'?email='.urlencode($this->user->email)));
|
2017-02-17 19:26:02 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $message;
|
2016-09-05 12:00:56 -04:00
|
|
|
}
|
|
|
|
|
}
|