File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Notifications/SiteUserSetPasswordNotification.php
<?php
namespace App\Notifications;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
/**
* Notification to tell a user to set 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 SiteUserSetPasswordNotification extends Notification
{
use Queueable;
/** @var Authenticatable $authenticatable */
private $authenticatable;
/** @var string */
private $token;
/**
* Create a new notification instance.
*
* @param Authenticatable $authenticatable
* @param string $token
*/
public function __construct(Authenticatable $authenticatable, string $token)
{
$this->authenticatable = $authenticatable;
$this->token = $token;
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail'];
}
/**
* Get the mail representation of the notification.
*
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail()
{
$mail = (new MailMessage)->view('emails.site_user.setPassword', [
'authenticatable' => $this->authenticatable,
'setPasswordUrl' => route('site.password.set', ['token' => $this->token]), //WARNING!!! NEVER PASS THE EMAIL TO THE BLADE. THIS CREATES A SECURITY RISK
])->subject(__('notifications.site_reset_password.subject'));
return $mail;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}