2017-08-31 21:18:05 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
2020-11-12 15:09:40 -08:00
|
|
|
use App\Helpers\Helper;
|
2017-08-31 21:18:05 -07:00
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
class ExpectedCheckinNotification extends Notification
|
|
|
|
{
|
|
|
|
use Queueable;
|
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
|
|
|
private $params;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new notification instance.
|
|
|
|
*
|
|
|
|
* @param $params
|
|
|
|
*/
|
|
|
|
public function __construct($params)
|
|
|
|
{
|
|
|
|
$this->params = $params;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the notification's delivery channels.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function via()
|
2017-08-31 21:18:05 -07:00
|
|
|
{
|
|
|
|
$notifyBy = [];
|
|
|
|
$item = $this->params['item'];
|
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
$notifyBy[] = 'mail';
|
|
|
|
|
2017-08-31 21:18:05 -07:00
|
|
|
return $notifyBy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mail representation of the notification.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage
|
|
|
|
*/
|
2020-05-23 11:56:56 -07:00
|
|
|
public function toMail()
|
2017-08-31 21:18:05 -07:00
|
|
|
{
|
2020-11-12 15:09:40 -08:00
|
|
|
$message = (new MailMessage)->markdown('notifications.markdown.expected-checkin',
|
|
|
|
[
|
|
|
|
'date' => Helper::getFormattedDateObject($this->params->expected_checkin, 'date', false),
|
|
|
|
'asset' => $this->params->present()->name(),
|
|
|
|
'serial' => $this->params->serial,
|
2021-06-10 13:15:52 -07:00
|
|
|
'asset_tag' => $this->params->asset_tag,
|
2020-11-12 15:09:40 -08:00
|
|
|
])
|
|
|
|
->subject(trans('mail.Expected_Checkin_Notification', ['name' => $this->params->present()->name()]));
|
|
|
|
|
|
|
|
return $message;
|
2017-08-31 21:18:05 -07:00
|
|
|
}
|
|
|
|
}
|