Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Notifications/AccountCreated.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Notifications;
4
5
use Pterodactyl\Models\User;
6
use Illuminate\Bus\Queueable;
7
use Illuminate\Notifications\Notification;
8
use Illuminate\Contracts\Queue\ShouldQueue;
9
use Illuminate\Notifications\Messages\MailMessage;
10
11
class AccountCreated extends Notification implements ShouldQueue
12
{
13
use Queueable;
14
15
/**
16
* Create a new notification instance.
17
*/
18
public function __construct(public User $user, public ?string $token = null)
19
{
20
}
21
22
/**
23
* Get the notification's delivery channels.
24
*/
25
public function via(): array
26
{
27
return ['mail'];
28
}
29
30
/**
31
* Get the mail representation of the notification.
32
*/
33
public function toMail(): MailMessage
34
{
35
$message = (new MailMessage())
36
->greeting('Hello ' . $this->user->name . '!')
37
->line('You are receiving this email because an account has been created for you on ' . config('app.name') . '.')
38
->line('Username: ' . $this->user->username)
39
->line('Email: ' . $this->user->email);
40
41
if (!is_null($this->token)) {
42
return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->token . '?email=' . urlencode($this->user->email)));
43
}
44
45
return $message;
46
}
47
}
48
49