2018-07-18 19:15:45 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class ExpiringLicenseNotification extends Notification
|
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
|
|
|
private $params;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @param $params
|
|
|
|
*/
|
|
|
|
public function __construct($params, $threshold)
|
|
|
|
{
|
|
|
|
$this->licenses = $params;
|
|
|
|
$this->threshold = $threshold;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @param mixed $notifiable
|
|
|
|
* @return array
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function via()
|
2018-07-18 19:15:45 -07:00
|
|
|
{
|
|
|
|
$notifyBy = [];
|
2021-06-10 13:15:52 -07:00
|
|
|
$notifyBy[] = 'mail';
|
|
|
|
|
2018-07-18 19:15:45 -07:00
|
|
|
return $notifyBy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @param mixed $asset
|
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function toMail()
|
2018-07-18 19:15:45 -07:00
|
|
|
{
|
|
|
|
$message = (new MailMessage)->markdown('notifications.markdown.report-expiring-licenses',
|
|
|
|
[
|
|
|
|
'licenses' => $this->licenses,
|
|
|
|
'threshold' => $this->threshold,
|
|
|
|
])
|
|
|
|
->subject(trans('mail.Expiring_Licenses_Report'));
|
|
|
|
|
|
|
|
return $message;
|
|
|
|
}
|
|
|
|
}
|