How it works

@startuml
|Sender|
start
: centerNotification = createObject(CenterNotification);
: user.notify(centerNotification);
|ChannelManager|
: WebPushChannel.send(user, centerNotification);
|WebPushChannel|
: centerNotification.toWebPush();
|WebPushChannel|
: send;
|ChannelManager|
: NotificationCenterChannel.send(user, centerNotification);
|NotificationCenterChannel|
: entry = centerNotification.toNotificationCenterEntry();
|NotificationCenterChannel|
: center.create(entry);
|NotificationCenter|
: Notification Center Stuff;
: entry.save();
stop
@enduml

CenterNotification

The CenterNotification class. This is the class that should be interacted with when creating and sending notifications. It is not an Eloquent model. Rather, CenterNotification is sent to the NotificationCenterChannel and the WebPush channel classes, which transform the object into the data representation they need.

NotificationCenterEntry

The NotificationCenterEntry class is an Eloquent model describing a stored notification with the ID from CenterNotification. It can be constructed by calling toNotificationCenterEntry on a CenterNotification. This model is managed by the NotificationCenter class, which is represented as a singleton with app(NotificationCenter::class).

WebPushMessage

The WebPushMessage class is used by the WebPushChannel and can be constructed by calling toWebPush on a CenterNotification.

WorkflowNotification

The WorkflowNotification class is a basic model that is fed with data from action/notify workflow element. It can be transformed to a ToastMessage, a Mailable and to a CenterNotification.