File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Notifications/SiteUserResetPasswordNotification.php
<?php
namespace App\Notifications;
use App\Users\SiteUserInterface;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
/**
* Notification to tell a user to reset his password
*/
//TODO: This notification is a copy of the kms set password notification and needs to be revised before being used in production
class SiteUserResetPasswordNotification extends Notification
{
use Queueable;
/** @var SiteUserInterface $authenticatable */
private $authenticatable;
/** @var string $token The password reset token */
private $token;
/**
* Create a new notification instance.
*
* @param SiteUserInterface $authenticatable
* @param string $token The password reset token
*/
public function __construct(SiteUserInterface $authenticatable, string $token)
{
$this->token = $token;
$this->authenticatable = $authenticatable;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail()
{
$mail = (new MailMessage)->view('emails.resetPassword', [
'authenticatable' => $this->authenticatable,
'resetPasswordUrl' => route('site.password.reset', ['token' => $this->token]), //WARNING!!! NEVER PASS THE EMAIL TO THE BLADE. THIS CREATES A SECURITY RISK
])->subject(__('notifications.site_set_password.subject'));
return $mail;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
];
}
}