Laravel Rocket 聊天通知功能扩展包
Laravel  /  管理员 发布于 3年前   886
Laravel Rocket Chat Notifications 是一个使用 RocketChat 和 Laravel 9+ 轻松发送通知的软件包:
use Illuminate\Notifications\Notification;
use TeamNiftyGmbh\RocketChatNotifications\Channels\RocketChatNotificationChannel;
use TeamNiftyGmbh\RocketChatNotifications\Messages\RocketChatMessage;
class TaskCompleted extends Notification
{
public function via(mixed $notifiable): array
{
return [
RocketChatNotificationChannel::class
];
}
public function toRocketChat($notifiable): RocketChatMessage
{
return RocketChatMessage::create('Test Message');
}
}
Rocket Chat Message 类具有方便的方法来制定您的 RocketChat 消息。
以下是其中一些示例,包括添加附件:
public function toRocketChat($notifiable)
{
return RocketChatMessage::create('Test message')
// optional if set in config
->to('channel_name')
// optional if set in config
->from('access_token', 'rocket_chat_user_id')
->attachments([
RocketChatAttachment::create()
->imageUrl('test'),
RocketChatAttachment::create([
'image_url' => 'test'
]),
new RocketChatAttachment(['image_url' => 'test']),
// Or via array
[
'image_url' => 'test'
]
]);
}
有关所有内容的完整列表,您可以格式化消息,查看自述文件中的可用方法。
https://github.com/Team-Nifty-GmbH/laravel-rocket-chat-notifications/tree/be3e7a95653b3c737407e84175376efdcf2a7d99#available-methods
Rocket.Chat 是一个具有私人聊天、团队聊天等功能的通信平台,包括 SaaS 产品和自我管理安装的定价选项。
https://rocket.chat/
您可以了解有关此软件包的更多信息,获取完整的安装说明,并在 GitHub 上查看源代码。
https://github.com/Team-Nifty-GmbH/laravel-rocket-chat-notifications
转:
https://laravel-news.com/laravel-rocket-chat-notifications
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号