Skip to content

Notifications ​

Modularous ships two tiers of notifications that serve different purposes.

TierNamespacePurpose
Auth notificationsUnusualify\Modularous\Notifications\Low-level transactional emails for registration and password flows
System notificationsModules\SystemNotification\Notifications\Feature-rich, queue-able, multi-channel notifications tied to model lifecycle events

Tier 1 — Auth Notifications ​

Three standalone notification classes in src/Notifications/:

ClassTriggered byEmail subject
EmailVerificationRegistration with email verification"Email Verification"
GeneratePasswordNotificationNew account with generated password"Generate Your Password For New Account"
ResetPasswordNotificationForgot-password flow"Reset your {app} password"

These extend Laravel's Notification directly, deliver only via mail, and are not queued by default.

→ Auth Notifications reference


Tier 2 — System Notifications ​

Fourteen notification classes in the SystemNotification module, all extending FeatureNotification:

ClassTriggered byDefault channels
ModelCreatedNotificationModelCreated eventmail
ModelUpdatedNotificationModelUpdated eventmail
ModelDeletedNotificationModelDeleted eventmail
ModelRestoredNotificationModelRestored eventmail
ModelForceDeletedNotificationModelForceDeleted eventmail
StateableUpdatedNotificationStateableUpdated eventconfigurable
TaskCreatedNotificationAssignmentCreated eventconfigurable
TaskUpdatedNotificationAssignmentUpdated eventconfigurable
TaskAssignedToAuthorizableNotificationAssignmentCreated eventdatabase,mail
PaymentCompletedNotificationPaymentCompleted eventconfigurable
PaymentFailedNotificationPaymentFailed eventdatabase,mail
ChatableUnreadNotificationUnreadChatMessage eventconfigurable
FeatureNotificationAbstract base — not dispatched directly—
LogNotificationMonolog handlermail

→ FeatureNotification base class
→ System Notifications reference


Notification Model ​

The SystemNotification module stores database-channel notifications in a notifications table via the Notification Eloquent model.

notifications table
├── id            (UUID string, non-incrementing)
├── type          (fully-qualified notification class name)
├── notifiable_type / notifiable_id  (polymorphic)
├── data          (JSON — subject, message, htmlMessage, redirector, …)
└── read_at       (nullable datetime)

Appended attributes on the model: is_read, is_mine, subject, message, html_message, redirector, has_redirector, redirector_text.


Flow: Event → Listener → Notification ​

[Model saved / state changed / payment event]
        │
        â–¼
  SystemNotification Event dispatched
  (e.g. ModelUpdated, StateableUpdated)
        │
        â–¼
  Listener::handle($event)
  (e.g. ModelListener, StateableListener)
        │
        ├─► notification->notify(...)  [database channel]
        │       stored in notifications table
        │
        └─► Notification::route('mail', ...)  [mail channel]
                queued via modularous.notifications.mail_queue

Configuration ​

All system-notification behaviour is governed by config/modularous.php under the notifications key:

KeyDescription
modularous.mail.enabledMaster switch — disables all mail from Listener::handle() when false
modularous.notifications.mail_connectionQueue connection used for mail channel
modularous.notifications.database_connectionQueue connection used for database channel
modularous.notifications.mail_queueQueue name for mail jobs
modularous.notifications.database_queueQueue name for database notification jobs
modularous.notifications.{ClassName}.channelsPer-class channel override (comma-separated string)
modularous.notifications.authorizable.channelsChannel override for TaskAssignedToAuthorizableNotification