-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVerifyEmailNotification.php
76 lines (66 loc) · 2.29 KB
/
VerifyEmailNotification.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace TinnyApi\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use Illuminate\Config\Repository as ConfigRepository;
class VerifyEmailNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* @var string
*/
private $token;
/**
* @var ConfigRepository
*/
private $configRepository;
/**
* VerifyEmailNotification constructor.
*
* @param ConfigRepository $configRepository
*/
public function __construct(ConfigRepository $configRepository)
{
$this->configRepository = $configRepository;
$this->onQueue('notifications');
}
public function via(): array
{
return ['mail'];
}
public function toMail($notifiable): MailMessage
{
return (new MailMessage())
->markdown('emails.default')
->success()
->subject(__(':app_name - Confirm your registration', ['app_name' => config('app.name')]))
->greeting(__('Welcome to :app_name', ['app_name' => config('app.name')]))
->line(__('Click the link below to complete verification:'))
->action(__('Verify Email'), url('/user/verify/' . $this->token))
->line('<b>' . __('5 Security Tips') . '</b>')
->line('<small>' . __('DO NOT give your password to anyone!') . '<br>' .
__(
'DO NOT call any phone number for someone clainming to be :app_name support!',
['app_name' => config('app.name')]
) . '<br>' .
__(
'DO NOT send any money to anyone clainming to be a member of :app_name!',
['app_name' => config('app.name')]
) . '<br>' .
__('Enable Two Factor Authentication!') . '<br>' .
__('Make sure you are visiting :app_url', [
'app_url' => $this->configRepository->get('app.url')
]) . '</small>');
}
/**
* @param string $token
* @return $this
*/
public function setToken(string $token): VerifyEmailNotification
{
$this->token = $token;
return $this;
}
}