You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.6 KiB

11 months ago
<?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)
8 months ago
->from(config('mail.from.address'), 'tinge Suzhou HR')
11 months ago
->subject('拜访申请审核通过通知 - ' . $visitData['name'])
->greeting('您好 ' . $visitData['visitor_name'] . '')
->line('您的拜访申请已审核通过,预约于 ' . $visitData['date'] . ' 到访。')
->line('被访人:' . $visitData['accept_admin_name'])
->line('公司名称:' . $visitData['company_name'])
8 months ago
->line('请按时到访,如有疑问请联系被访人。')
8 months ago
->salutation('')
8 months ago
->line('Regards');
11 months ago
} else {
// 审核驳回的邮件
return (new MailMessage)
8 months ago
->from(config('mail.from.address'), 'tinge Suzhou HR')
11 months ago
->subject('拜访申请审核驳回通知 - ' . $visitData['name'])
->greeting('您好 ' . $visitData['visitor_name'] . '')
->line('很抱歉,您的拜访申请未通过审核。')
->line('预约日期:' . $visitData['date'])
->line('被访人:' . $visitData['accept_admin_name'])
->line('公司名称:' . $visitData['company_name'])
8 months ago
->line('如有疑问,请联系被访人或重新提交申请。')
8 months ago
->salutation('')
8 months ago
->line('Regards');
11 months ago
}
}
}