Laravel Notification Log | By Spatie

Laravel Notification Log | By Spatie

Laravel?Notification Log?is a package by Spatie to log notifications your Laravel app sends. This will allow you to query notification logs in the database for your app users:

// returns a collection of `NotificationLogItem` model
$sentNotifications = $user->loggedNotifications();        

You can customize which notifications get logged, and by default, all notifications are logged. Each notification can have custom logic by defining a?`shouldLog`?method to determine if the notification should get logged:

use Illuminate\Notifications\Events\NotificationSending
?
// in a notification
public function shouldLog(NotificationSending $event): bool
{
    // i.e., custom logic to decide if a notification
    // should get logged...
    return true;
};        

Using this package, you can also query all logged notifications using a provided Eloquent model. This package offers additional customization options such as logging extra notification data, defining a notification fingerprint signature, and more. You can learn about all the options in the?official documentation. Documentation link mention below

Source Code :- https://github.com/spatie/laravel-notification-log

Official Documentation :- https://spatie.be/docs/laravel-notification-log/v1/introduction

要查看或添加评论,请登录

Gagan Kumar Sharma的更多文章

社区洞察

其他会员也浏览了