Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Notification Log Laravel Package

spatie/laravel-notification-log

Logs all notifications sent by your Laravel app, storing them as NotificationLogItems so you can query what was sent to a user, display notification history, and make sending decisions (e.g., avoid duplicates) via helpers like wasSentTo() and inThePastMinutes().

View on GitHub
Deep Wiki
Context7

title: Customizing the logging process weight: 3

The ConvertNotificationSendingEventToLogItemAction class determines how notifications will get logged by default. It contains many methods that can be overridden to customize how notifications will get logged.

To override methods, start by creating a class of your own that extends the default ConvertNotificationSendingEventToLogItemAction action. Override any method you want from the base class.

In the following example, we'll create a custom action that will use the base name of a class instead of the fqcn to use as the type.

use Spatie\NotificationLog\Actions\ConvertNotificationSendingEventToLogItemAction;

class CustomConversionAction extends ConvertNotificationSendingEventToLogItemAction
{
    protected function getNotificationType(NotificationSending $event): string
    {
        $notification = $event->notification;

        return class_basename($notification);
    }
}

You should register your custom class in the actions.convertEventToModel key of the notification-log config file.

return [
    // ...

    'actions' => [
        'convertEventToModel' => CustomConversionAction::class,
    ],
]
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation