企业微信Notification模板生成
php artisan extend
命令可以帮助您生成钉钉 Notification
,
选择代码生成器 【4】,在选择【0】 即可生成 WechatNotification
在项目的 Notifications
目录中可以看到 WechatNotification
具体代码为:
<?php
namespace App\Notifications;
use Chowjiawei\Helpers\Channels\WechatRobotChannel;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
class WechatNotification extends Notification
{
use Queueable;
public function __construct($test)
{
$this->test=$test;
}
public function via($notifiable)
{
return [WechatRobotChannel::class];
}
public function toWechatRobot($notifiable)
{
return $this->text;
}
}
使用方法为:
Notification::route('wechat_robot', config('helpers.dingtalk'))
->notify(new WechatNotification($message, "通知"));
推荐文章: