jjsoft-ar/notification-module

处理实时通知的模块

安装: 4

依赖: 0

建议者: 1

安全: 0

星星: 0

关注者: 2

分支: 15

类型:asgard-module

1.4.0 2016-06-08 13:26 UTC

This package is auto-updated.

Last update: 2024-09-09 01:45:40 UTC


README

Latest Version Software License Quality Score SensioLabs Insight

Total Downloads Total Downloads Total Downloads Slack

快速向您的AsgardCms应用程序发送(实时)通知。

$this->notification->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));
/**
* Push a notification on the dashboard
* @param string $title
* @param string $message
* @param string $icon
* @param string|null $link
*/
public function push($title, $message, $icon, $link = null);

Notifications demo screenshot 快速演示

安装

在项目中要求模块

composer require asgardcms/notification-module

发布配置

php artisan module:publish notification

实时?

如果您想要通过WebSockets进行实时通知,您需要配置broadcasting.php配置文件。完成此操作后,将asgard.notification.config.real-time选项设置为true

目前,Laravel广播支持Pusher和Redis,但AsgardCms只为Pusher提供了前端集成。更多集成可以通过pull-request来欢迎。看看Pusher集成以获得灵感。

使用方法

使用简单直接

在需要的地方注入Modules\Notification\Services\Notification接口并将其分配给类变量。

向已登录用户发送通知

$this->notification->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));

向特定用户发送通知

$this->notification->to($userId)->push('New subscription', 'Someone has subscribed!', 'fa fa-hand-peace-o text-green', route('admin.user.user.index'));