File: D:/HostingSpaces/SBogers10/carrot.komma.pro/app/Notifications/UserSetPassword.php
<?php
namespace App\Notifications;
use App\Komma\Users\Models\KmsUser;
use App\Komma\Users\Models\SiteUser;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Notifications\Messages\MailMessage;
/**
* Class CustomerRegisteredSetPassword
*
* Notitication to tell a user to set his password
*
* @package App\Notifications
*/
class UserSetPassword extends Notification
{
use Queueable;
/** @var SiteUser $user */
private $user;
/** @var string */
private $token;
/**
* Create a new notification instance.
*
* @param Authenticatable $user
* @param string $token
*/
public function __construct(Authenticatable $user, string $token)
{
$this->user = $user;
$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()
{
$viewName = is_a($this->user, KmsUser::class) ? 'emails.kms.setPassword' : 'emails.customer.setPassword';
$mail = (new MailMessage)->view($viewName, [
'user' => $this->user,
'token' => $this->token,
])->subject(__('notifications.customer_set_password.subject'));
return $mail;
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
//
];
}
}