企业微信Notification模板生成

未匹配的标注

php artisan extend命令可以帮助您生成钉钉 Notification,

选择代码生成器 【4】,在选择【0】 即可生成 WechatNotification

企业微信Notification模板生成

在项目的 Notifications 目录中可以看到 WechatNotification

企业微信Notification模板生成

具体代码为:

<?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, "通知"));

本文章首发在 LearnKu.com 网站上。

上一篇 下一篇
chowjiawei
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
讨论数量: 0
发起讨论 只看当前版本


暂无话题~