|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
namespace App\Notifications;
|
|
|
|
|
|
|
|
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
|
|
|
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
|
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
|
|
|
|
use Illuminate\Notifications\Notification;
|
|
|
|
|
|
|
|
|
|
|
|
class AuditResultEmailNotify extends Notification
|
|
|
|
|
|
{
|
|
|
|
|
|
use Queueable;
|
|
|
|
|
|
|
|
|
|
|
|
protected $visitData;
|
|
|
|
|
|
protected $auditResult;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Create a new notification instance.
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param array $visitData
|
|
|
|
|
|
* @param string $auditResult
|
|
|
|
|
|
*/
|
|
|
|
|
|
public function __construct($visitData, $auditResult)
|
|
|
|
|
|
{
|
|
|
|
|
|
$this->visitData = $visitData;
|
|
|
|
|
|
$this->auditResult = $auditResult;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 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($notifiable)
|
|
|
|
|
|
{
|
|
|
|
|
|
$visitData = $this->visitData;
|
|
|
|
|
|
$auditResult = $this->auditResult;
|
|
|
|
|
|
|
|
|
|
|
|
if ($auditResult === '通过') {
|
|
|
|
|
|
// 审核通过的邮件
|
|
|
|
|
|
return (new MailMessage)
|
|
|
|
|
|
->from('no-reply@tinge.com', 'tinge Suzhou HR')
|
|
|
|
|
|
->subject('拜访申请审核通过通知 - ' . $visitData['name'])
|
|
|
|
|
|
->greeting('您好 ' . $visitData['visitor_name'] . ',')
|
|
|
|
|
|
->line('您的拜访申请已审核通过,预约于 ' . $visitData['date'] . ' 到访。')
|
|
|
|
|
|
->line('被访人:' . $visitData['accept_admin_name'])
|
|
|
|
|
|
->line('公司名称:' . $visitData['company_name'])
|
|
|
|
|
|
->line('请按时到访,如有疑问请联系被访人。')
|
|
|
|
|
|
->line('')
|
|
|
|
|
|
->line('Regards');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 审核驳回的邮件
|
|
|
|
|
|
return (new MailMessage)
|
|
|
|
|
|
->from('no-reply@tinge.com', 'tinge Suzhou HR')
|
|
|
|
|
|
->subject('拜访申请审核驳回通知 - ' . $visitData['name'])
|
|
|
|
|
|
->greeting('您好 ' . $visitData['visitor_name'] . ',')
|
|
|
|
|
|
->line('很抱歉,您的拜访申请未通过审核。')
|
|
|
|
|
|
->line('预约日期:' . $visitData['date'])
|
|
|
|
|
|
->line('被访人:' . $visitData['accept_admin_name'])
|
|
|
|
|
|
->line('公司名称:' . $visitData['company_name'])
|
|
|
|
|
|
->line('如有疑问,请联系被访人或重新提交申请。')
|
|
|
|
|
|
->line('')
|
|
|
|
|
|
->line('Regards');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|