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.

57 lines
1.4 KiB

9 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 CancelEmailNotify extends Notification
{
use Queueable;
protected $visitData;
/**
* Create a new notification instance.
*
* @param array $visitData
*/
public function __construct($visitData)
{
$this->visitData = $visitData;
}
/**
* 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;
return (new MailMessage)
->subject('拜访预约取消通知 - ' . $visitData['name'])
->greeting('您好 ' . $notifiable->name . '')
->line('访客 ' . $visitData['name'] . ' 原预约于 ' . $visitData['date'] . ' 的拜访已取消。')
->line('访客联系电话:' . $visitData['mobile'])
->line('拜访事由:' . ($visitData['reason'] ?? '无'))
->line('如有疑问,请联系访客确认。');
}
}