1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Pterodactyl - Panel |
4
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>. |
5
|
|
|
* |
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
8
|
|
|
* in the Software without restriction, including without limitation the rights |
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
11
|
|
|
* furnished to do so, subject to the following conditions: |
12
|
|
|
* |
13
|
|
|
* The above copyright notice and this permission notice shall be included in all |
14
|
|
|
* copies or substantial portions of the Software. |
15
|
|
|
* |
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22
|
|
|
* SOFTWARE. |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace Pterodactyl\Notifications; |
26
|
|
|
|
27
|
|
|
use Illuminate\Bus\Queueable; |
28
|
|
|
use Illuminate\Notifications\Notification; |
29
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue; |
30
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
31
|
|
|
|
32
|
|
|
class AccountCreated extends Notification implements ShouldQueue |
33
|
|
|
{ |
34
|
|
|
use Queueable; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* The password reset token to send. |
38
|
|
|
* |
39
|
|
|
* @var object |
40
|
|
|
*/ |
41
|
|
|
public $user; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Create a new notification instance. |
45
|
|
|
* |
46
|
|
|
* @param aray $user |
47
|
|
|
* @return void |
|
|
|
|
48
|
|
|
*/ |
49
|
|
|
public function __construct(array $user) |
50
|
|
|
{ |
51
|
|
|
$this->user = (object) $user; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Get the notification's delivery channels. |
56
|
|
|
* |
57
|
|
|
* @param mixed $notifiable |
58
|
|
|
* @return array |
59
|
|
|
*/ |
60
|
|
|
public function via($notifiable) |
|
|
|
|
61
|
|
|
{ |
62
|
|
|
return ['mail']; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Get the mail representation of the notification. |
67
|
|
|
* |
68
|
|
|
* @param mixed $notifiable |
69
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
70
|
|
|
*/ |
71
|
|
|
public function toMail($notifiable) |
72
|
|
|
{ |
73
|
|
|
$message = (new MailMessage) |
74
|
|
|
->greeting('Hello ' . $this->user->name . '!') |
75
|
|
|
->line('You are recieving this email because an account has been created for you on Pterodactyl Panel.') |
76
|
|
|
->line('Username: ' . $this->user->username) |
77
|
|
|
->line('Email: ' . $notifiable->email); |
78
|
|
|
|
79
|
|
|
if (! is_null($this->user->token)) { |
80
|
|
|
return $message->action('Setup Your Account', url('/auth/password/reset/' . $this->user->token . '?email=' . $notifiable->email)); |
|
|
|
|
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
return $message; |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.