DatabaseNotification

markAsRead

Marks the notification as read and updates the database.

Name
Type
Required
Default
Description

readDate

date

false

now()

The date to use when marking the notification as read.

Return: This DatabaseNotification instance.

markAsRead

Deletes the notification from the database.

Name
Type
Required
Default
Description

No arguments

Return: This DatabaseNotification instance.

getMemento

Returns a serializable representation of this DatabaseNotification.

{
    "id": getId(),
    "type": getType(),
    "notifiableType": getNotifiableType(),
    "notifiableId": getNotifiableId(),
    "data": getData(),
    "readDate": getReadDate(),
    "createdDate": getCreatedDate()
}
Name
Type
Required
Default
Description

No arguments

Return: (struct) The memento of this DatabaseNotification instance.

populateFromDatabaseRow

Returns the Channel instance the notification belongs to.

This method also handles deserializing the data property from JSON.

Name
Type
Required
Default
Description

properties

struct

true

The properties to set for this DatabaseNotification instance.

Return: This DatabaseNotification instance.

Accessors

getChannel

Returns the Channel instance the notification belongs to.

Name
Type
Required
Default
Description

No arguments

Return: (BaseProvider) The Channel instance.

getId

Returns the id in the database of this notification.

Name
Type
Required
Default
Description

No arguments

Return: (string) The DatabaseNotification id.

getType

Returns the Notification Type of the Notification. Populated in the database from calling Notification#getNotificationType which defaults to the WireBox id of the notification.

Name
Type
Required
Default
Description

No arguments

Return: (string) The Notification Type of the DatabaseNotification.

getNotifiableType

Returns the stored Notifiable type of the Notification. Populated in the database from calling INotifiable#getNotifiableType when storing the notification.

Name
Type
Required
Default
Description

No arguments

Return: (string) The Notifiable type of the DatabaseNotification.

getNotifiableId

Returns the stored Notifiable id of the Notification. Populated in the database from calling INotifiable#getNotifiableId when storing the notification.

Name
Type
Required
Default
Description

No arguments

Return: (string) The Notifiable id of the DatabaseNotification.

getData

Returns the data sent for the notification. Populated in the database from calling toDatabase on the Notification instance when storing the notification.

Name
Type
Required
Default
Description

No arguments

Return: (struct) The data of the DatabaseNotification.

getReadDate

Returns the read date of the notification. Returns an empty string if the notification hasn't been read.

Name
Type
Required
Default
Description

No arguments

Return: (date) The read date of the DatabaseNotification.

getCreatedDate

Returns the created date of the notification.

Name
Type
Required
Default
Description

No arguments

Return: (date) The created date of the DatabaseNotification.

The setters of this component should be considered private.

setChannel

Sets the Channel instance the notification belongs to.

Name
Type
Required
Default
Description

channel

BaseProvider

true

The Channel instance the notification belongs to.

Return: This DatabaseNotification instance.

setId

Sets the id of the DatabaseNotification.

Name
Type
Required
Default
Description

id

string

true

The id of the DatabaseNotification.

Return: This DatabaseNotification instance.

setType

Sets the type of the DatabaseNotification.

Name
Type
Required
Default
Description

type

string

true

The type of the DatabaseNotification.

Return: This DatabaseNotification instance.

setNotifiableType

Sets the Notifiable type of the DatabaseNotification.

Name
Type
Required
Default
Description

notifiableType

string

true

The Notifiable type of the DatabaseNotification.

Return: This DatabaseNotification instance.

setNotifiableId

Sets the Notifiable id of the DatabaseNotification.

Name
Type
Required
Default
Description

notifiableId

string

true

The Notifiable id of the DatabaseNotification.

Return: This DatabaseNotification instance.

setData

Sets the data of the DatabaseNotification.

Name
Type
Required
Default
Description

data

struct

true

The data of the DatabaseNotification.

Return: This DatabaseNotification instance.

setReadDate

Sets the read date of the DatabaseNotification.

Consider using the markAsRead method instead of interacting with this setter directly as the markAsRead method will also update the database.

Name
Type
Required
Default
Description

readDate

date

true

The read date of the DatabaseNotification.

Return: This DatabaseNotification instance.

setReadDate

Sets the created date of the DatabaseNotification.

Name
Type
Required
Default
Description

createdDate

date

true

The created date of the DatabaseNotification.

Return: This DatabaseNotification instance.

Last updated