Initialer Laravel Commit für BetiX
This commit is contained in:
44
app/Notifications/NewLoginDetected.php
Normal file
44
app/Notifications/NewLoginDetected.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class NewLoginDetected extends Notification implements ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public string $ip;
|
||||
public string $userAgent;
|
||||
public string $loginAt;
|
||||
|
||||
public function __construct(string $ip, string $userAgent, string $loginAt)
|
||||
{
|
||||
$this->ip = $ip;
|
||||
$this->userAgent = $userAgent;
|
||||
$this->loginAt = $loginAt;
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
{
|
||||
return ['mail'];
|
||||
}
|
||||
|
||||
public function toMail(object $notifiable): MailMessage
|
||||
{
|
||||
return (new MailMessage)
|
||||
->subject('New Login Detected on Your Account')
|
||||
->view('emails.new-login', [
|
||||
'user' => $notifiable,
|
||||
'ip' => $this->ip,
|
||||
'userAgent' => $this->userAgent,
|
||||
'loginAt' => $this->loginAt,
|
||||
'appName' => config('app.name'),
|
||||
'supportEmail' => config('mail.from.address'),
|
||||
'manageLink' => url('/settings/security'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user