Files
laravel-nuxt-ui-inertia-tem…/app/Notifications/TwoFactorSecurityNotification.php

40 lines
1.1 KiB
PHP

<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TwoFactorSecurityNotification extends Notification implements ShouldQueue
{
use Queueable;
public function __construct(
public readonly string $activity,
public readonly string $ipAddress,
public readonly string $occurredAt
) {}
/**
* @return list<string>
*/
public function via(object $notifiable): array
{
return ['mail'];
}
public function toMail(object $notifiable): MailMessage
{
return (new MailMessage)
->subject('Two-factor authentication security notice')
->greeting('Hello '.$notifiable->first_name.',')
->line($this->activity)
->line("Time: {$this->occurredAt}")
->line("IP address: {$this->ipAddress}")
->line('If you did not perform this action, change your password and contact support immediately.')
->action('Review account security', url('/profile'));
}
}