samueletur / magic-channel-notification
用于与 Magic Forms 集成的通知渠道
0.0.3
2022-06-09 19:07 UTC
Requires
- php: >7.4
This package is auto-updated.
Last update: 2024-09-09 23:42:54 UTC
README
使用 Magic Form 通过公司提供的 API 发送消息
安装
使用 composer 进行安装
composer require samueletur/magic-channel-notification
配置
在 .env 文件中添加参数 MM2_CODIGO
,并使用收到的 token
MM2_CODIGO=XXX
生成通知后,在 via 函数中指定发送通道为 magic
public function via($notifiable) { return ['magic']; }
在 toArray 函数中配置返回参数
public function toArray($notifiable) { return [ 'template' => base64_encode($this->mailTemplate($notifiable)), 'template_emails_to' => $notifiable->email, 'mm2_assunto' => 'Novo arquivo compartilhado - Magic Files Exchange', ]; }
模板
添加发送电子邮件模板的函数
public function mailTemplate($notifiable) { $template = get_class($this); return (new $template($this->groupFile))->toMail($notifiable)->render(); }
变更日志
有关最近更改的更多信息,请参阅 CHANGELOG
测试
composer test