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 Carbon\Carbon; |
19
|
|
|
use Illuminate\Http\Request; |
20
|
|
|
use Illuminate\Support\Facades\Lang; |
21
|
|
|
use Illuminate\Notifications\Notification; |
22
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
23
|
|
|
|
24
|
|
|
class AuthenticationLockoutNotification extends Notification |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* The request instance. |
28
|
|
|
* |
29
|
|
|
* @var \Illuminate\Http\Request |
30
|
|
|
*/ |
31
|
|
|
public $request; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Create a notification instance. |
35
|
|
|
* |
36
|
|
|
* @param \Illuminate\Http\Request $request |
37
|
|
|
* |
38
|
|
|
* @return void |
|
|
|
|
39
|
|
|
*/ |
40
|
|
|
public function __construct(Request $request) |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
$this->request = $request; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Get the notification's channels. |
47
|
|
|
* |
48
|
|
|
* @param mixed $notifiable |
49
|
|
|
* |
50
|
|
|
* @return array|string |
51
|
|
|
*/ |
52
|
|
|
public function via($notifiable) |
|
|
|
|
53
|
|
|
{ |
54
|
|
|
return ['mail']; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Build the mail representation of the notification. |
59
|
|
|
* |
60
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
61
|
|
|
*/ |
62
|
|
|
public function toMail() |
63
|
|
|
{ |
64
|
|
|
return (new MailMessage) |
65
|
|
|
->subject(Lang::get('rinvex.fort::email.auth.lockout.subject')) |
66
|
|
|
->line(Lang::get('rinvex.fort::email.auth.lockout.intro', [ |
67
|
|
|
'created_at' => new Carbon(), |
68
|
|
|
'ip' => $this->request->ip(), |
69
|
|
|
'agent' => $this->request->server('HTTP_USER_AGENT'), |
70
|
|
|
])) |
71
|
|
|
->line(Lang::get('rinvex.fort::email.auth.lockout.outro')); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
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.