spatie / laravel-notification-log
记录您的 Laravel 应用发送的通知
1.3.1
2024-03-28 08:05 UTC
Requires
- php: ^8.1|^8.2
- illuminate/contracts: ^10.0|^11.0
- spatie/laravel-package-tools: ^1.14.0
- spatie/test-time: ^1.3
Requires (Dev)
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.0|^8.1
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.0
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- spatie/laravel-ray: ^1.26
README
本软件包将记录您应用发送的所有通知。这将允许您根据应用已发送的通知编写逻辑。
如果您想创建一个包含发送给用户的所有通知的列表
// returns a collection of `NotificationLogItem` models $sentNotifications = $user->loggedNotifications();
在视图中,您可以编写如下代码
<ul> @foreach($sentNotifications as $sentNotification) <li>{{ $sentNotification->type }} at {{ $sentNotification->created_at->format('Y-m-d H:i:s') }}</li> @endforeach </ul>
该软件包还包含方便的方法,允许您根据发送的通知做出决策。以下是一个示例,我们在通知的 shouldSent
方法中使用了该软件包提供的 wasAlreadySentTo
方法。
// in a notification public function shouldSend($notifiable) { return ! $this ->wasAlreadySentTo($notifiable) ->inThePastMinutes(60); }
您可以完全自定义哪些通知被记录以及如何记录。
支持我们
我们在创建最佳开源软件包方面投入了大量资源。您可以通过购买我们的付费产品之一来支持我们。
我们非常感谢您从家乡寄给我们明信片,并说明您正在使用我们的哪个软件包。您可以在我们的联系页面上找到我们的地址。我们将在我们的虚拟明信片墙上发布所有收到的明信片。
文档
所有文档都可在我们的文档网站上找到。
测试
composer test
变更日志
请参阅变更日志以获取有关最近更改的更多信息。
贡献
请参阅贡献指南以获取详细信息。
安全漏洞
请参阅我们的安全策略以了解如何报告安全漏洞。
鸣谢
许可证
MIT 许可证(MIT)。请参阅许可证文件以获取更多信息。