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.

70 lines
1.5 KiB

12 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 EmailNotify extends Notification
{
use Queueable;
/**
* Create a new notification instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return ['mail', 'database'];
}
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
8 months ago
->from(config('mail.from.address'), 'tinge Suzhou HR')
12 months ago
->subject($notifiable->title)
8 months ago
->line($notifiable->content)
->line('')
->line('Regards');
12 months ago
}
/**
* Get the array representation of the notification.
*
* @param mixed $notifiable
* @return array
*/
public function toArray($notifiable)
{
return [
// 通知渠道。inner站内sms短信email邮件wechat微信服务号
'title' => $notifiable->title ?? '通知',
'content' => $notifiable->content ?? '',
'other' => $notifiable->other ?? []
];
}
}