1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace serwin35\AuthenticationLog\Notifications; |
4
|
|
|
|
5
|
|
|
use Illuminate\Bus\Queueable; |
6
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
7
|
|
|
use Illuminate\Notifications\Messages\NexmoMessage; |
|
|
|
|
8
|
|
|
use Illuminate\Notifications\Messages\SlackMessage; |
|
|
|
|
9
|
|
|
use Illuminate\Notifications\Notification; |
10
|
|
|
use serwin35\AuthenticationLog\AuthenticationLog; |
11
|
|
|
|
12
|
|
|
class NewDevice extends Notification |
13
|
|
|
{ |
14
|
|
|
use Queueable; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* The authentication log. |
18
|
|
|
* |
19
|
|
|
* @var \serwin35\AuthenticationLog\AuthenticationLog |
20
|
|
|
*/ |
21
|
|
|
public $authenticationLog; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Create a new notification instance. |
25
|
|
|
* |
26
|
|
|
* @param \serwin35\AuthenticationLog\AuthenticationLog $authenticationLog |
27
|
|
|
* @return void |
28
|
|
|
*/ |
29
|
|
|
public function __construct(AuthenticationLog $authenticationLog) |
30
|
|
|
{ |
31
|
|
|
$this->authenticationLog = $authenticationLog; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Get the notification's delivery channels. |
36
|
|
|
* |
37
|
|
|
* @param mixed $notifiable |
38
|
|
|
* @return array |
39
|
|
|
*/ |
40
|
|
|
public function via($notifiable) |
41
|
|
|
{ |
42
|
|
|
return $notifiable->notifyAuthenticationLogVia(); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Get the mail representation of the notification. |
47
|
|
|
* |
48
|
|
|
* @param mixed $notifiable |
49
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
50
|
|
|
*/ |
51
|
|
|
public function toMail($notifiable) |
52
|
|
|
{ |
53
|
|
|
return (new MailMessage) |
54
|
|
|
->subject(trans('authentication-log::messages.subject')) |
|
|
|
|
55
|
|
|
->markdown('authentication-log::emails.new', [ |
56
|
|
|
'account' => $notifiable, |
57
|
|
|
'time' => $this->authenticationLog->login_at, |
|
|
|
|
58
|
|
|
'ipAddress' => $this->authenticationLog->ip_address, |
|
|
|
|
59
|
|
|
'browser' => $this->authenticationLog->user_agent, |
|
|
|
|
60
|
|
|
]); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* Get the Slack representation of the notification. |
65
|
|
|
* |
66
|
|
|
* @param mixed $notifiable |
67
|
|
|
* @return \Illuminate\Notifications\Messages\SlackMessage |
68
|
|
|
*/ |
69
|
|
|
public function toSlack($notifiable) |
70
|
|
|
{ |
71
|
|
|
return (new SlackMessage) |
72
|
|
|
->from(config('app.name')) |
73
|
|
|
->warning() |
74
|
|
|
->content(trans('authentication-log::messages.content', ['app' => config('app.name')])) |
75
|
|
|
->attachment(function ($attachment) use ($notifiable) { |
76
|
|
|
$attachment->fields([ |
77
|
|
|
'Account' => $notifiable->email, |
78
|
|
|
'Time' => $this->authenticationLog->login_at->toCookieString(), |
|
|
|
|
79
|
|
|
'IP Address' => $this->authenticationLog->ip_address, |
|
|
|
|
80
|
|
|
'Browser' => $this->authenticationLog->user_agent, |
|
|
|
|
81
|
|
|
]); |
82
|
|
|
}); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Get the Nexmo / SMS representation of the notification. |
87
|
|
|
* |
88
|
|
|
* @param mixed $notifiable |
89
|
|
|
* @return \Illuminate\Notifications\Messages\NexmoMessage |
90
|
|
|
*/ |
91
|
|
|
public function toNexmo($notifiable) |
|
|
|
|
92
|
|
|
{ |
93
|
|
|
return (new NexmoMessage) |
94
|
|
|
->content(trans('authentication-log::messages.content', ['app' => config('app.name')])); |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths