Opscale\NotificationCenter\Notifications\CardNotificationChannel identifier:
cardUnderlying driver:
card (Notification Center custom channel)
CardNotification renders a delivery as a visual card on the Notification Center dashboard. Cards display a title, subtitle, colour variant badge, and an optional action button.
Method signatures
via()
Returns ['card'], which routes the notification through the Notification Center’s internal card channel.
toCard(object $notifiable): NotificationCard
Builds and returns a NotificationCard instance. The payload fields are:
| Field | Source |
|---|---|
| Title | $delivery->notification->subject |
| Subtitle | $delivery->notification->summary |
| Variant | Resolved from $delivery->notification->type->value via getVariant() |
| Action label | View (translated) |
| Action URL | Tracking open route for $delivery->open_slug |
| Action target | _blank |
getSubscription(): mixed
Overrides the base class to return the notifiable model instance. It resolves the contact from the profile’s subscription list, then calls find() on the notifiable’s Eloquent model.
getVariant(string $type): string
Maps the notification type to a card colour variant:
| Type value | Variant |
|---|---|
Alert | danger |
System | warning |
| (default) | primary |
What data it sends
TheNotificationCard object passed to the dashboard contains:
- A title string from the notification’s
subject - A subtitle string from the notification’s
summary - A colour variant derived from the notification type
- A “View” action button linking to the tracked open URL (opens in a new tab)
Usage example
Thecard channel is used in the alert strategy by default:
card channel step, CardNotification is instantiated with the Delivery model and a NotificationCard is persisted to the dashboard.
CardNotification uses a custom channel driver internal to the Notification Center. No additional third-party package is required.