robertbaelde/notificationtransactions

等待特定操作完成后再发送通知的能力

1.0.1 2020-02-03 14:38 UTC

This package is auto-updated.

Last update: 2024-09-29 05:29:38 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

此包会在事务提交前暂停通知的发送。如果例如在数据库事务内触发通知,这很有用。

安装

您可以通过composer安装此包

composer require robertbaelde/notificationtransactions

用法

 // Start a transaction 
 NotificationTransaction::start();
 
 // Trigger your notifications as usual 
 $user->notify(new ImportantNotification());
 
 // commit the notifications when you want to send them
 \NotificationTransaction::commit();
 
  // rollback the notifications when something failed and notifications must not be send. 
  \NotificationTransaction::rollback();
 
 // You can also use DI instead of the Facade. 
 $notificationTransaction = resolve(NotificationTransaction::class);
 $notificationTransaction->start();

测试

composer test

变更日志

请参阅CHANGELOG获取更多最近更改的信息。

贡献

请参阅CONTRIBUTING获取详细信息。

安全

如果您发现任何安全相关的问题,请通过robert@baelde.nl发送邮件,而不是使用问题跟踪器。

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件获取更多信息。

Laravel Package Boilerplate

此包是用Laravel Package Boilerplate生成的。