1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* NOTICE OF LICENSE |
5
|
|
|
* |
6
|
|
|
* Part of the Rinvex Fort Package. |
7
|
|
|
* |
8
|
|
|
* This source file is subject to The MIT License (MIT) |
9
|
|
|
* that is bundled with this package in the LICENSE file. |
10
|
|
|
* |
11
|
|
|
* Package: Rinvex Fort Package |
12
|
|
|
* License: The MIT License (MIT) |
13
|
|
|
* Link: https://rinvex.com |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Rinvex\Fort\Notifications; |
17
|
|
|
|
18
|
|
|
use Illuminate\Support\Facades\Lang; |
19
|
|
|
use Illuminate\Notifications\Notification; |
20
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
21
|
|
|
|
22
|
|
|
class RegistrationSuccessNotification extends Notification |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Indicates if this is social registration mode or not. |
26
|
|
|
* |
27
|
|
|
* @var bool |
28
|
|
|
*/ |
29
|
|
|
public $social; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Create a notification instance. |
33
|
|
|
* |
34
|
|
|
* @param bool $social |
35
|
|
|
* |
36
|
|
|
* @return void |
|
|
|
|
37
|
|
|
*/ |
38
|
|
|
public function __construct($social = false) |
39
|
|
|
{ |
40
|
|
|
$this->social = $social; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Get the notification's channels. |
45
|
|
|
* |
46
|
|
|
* @param mixed $notifiable |
47
|
|
|
* |
48
|
|
|
* @return array|string |
49
|
|
|
*/ |
50
|
|
|
public function via($notifiable) |
|
|
|
|
51
|
|
|
{ |
52
|
|
|
return ['mail']; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Build the mail representation of the notification. |
57
|
|
|
* |
58
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
59
|
|
|
*/ |
60
|
|
|
public function toMail() |
61
|
|
|
{ |
62
|
|
|
if ($this->social) { |
63
|
|
|
if (config('rinvex.fort.registration.moderated')) { |
64
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_moderation'); |
65
|
|
|
} else { |
66
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_default'); |
67
|
|
|
} |
68
|
|
|
} else { |
69
|
|
|
if (config('rinvex.fort.verification.required') && config('rinvex.fort.registration.moderated')) { |
70
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_verification_moderation'); |
71
|
|
|
} elseif (! config('rinvex.fort.verification.required') && config('rinvex.fort.registration.moderated')) { |
72
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_moderation'); |
73
|
|
|
} elseif (config('rinvex.fort.verification.required') && ! config('rinvex.fort.registration.moderated')) { |
74
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_verification'); |
75
|
|
|
} else { |
76
|
|
|
$phrase = Lang::get('rinvex.fort::email.registration.welcome.intro_default'); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
return (new MailMessage) |
81
|
|
|
->subject(Lang::get('rinvex.fort::email.registration.welcome.subject')) |
82
|
|
|
->line($phrase); |
83
|
|
|
} |
84
|
|
|
} |
85
|
|
|
|
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.