waarborg/databasenotifications
最新稳定版本:v2.0
Composer 安装命令:
composer require waarborg/databasenotifications
包简介
Database notifications driver for Laravel 5.3 and up
README 文档
README
This package makes it easy to send database notifications with Laravel 6 and up from third-party packages. Those often allow you to send mail or slack notifications, but with this package you can also send them to the notification table. For others, simply use Laravel's own notifications.
Contents
Installation
You can install the package via composer:
composer require waarborg/databasenotifications
Usage
Now you can use the channel in your via() method inside the notification:
use waarborg\DatabaseNotifications\DatabaseChannel; use waarborg\DatabaseNotifications\DatabaseMessage; use Illuminate\Notifications\Notification; class BackupHasFailed extends Notification { public function via($notifiable) { return [DatabaseChannel::class]; } public function toDatabase($notifiable) { return DatabaseMessage::create() ->user(1) ->data([ 'event' => 'Backup failed', 'description' => 'Daily backup of Your App has failed: reason, disk S3 is unreachable.', '...' => '...' ]); } }
Available Message methods
userThe user to send the notification to.dataAn array with custom fields. This can contain any key value pair you want.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-21