企业微信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
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 0
发起讨论 只看当前版本


暂无话题~