PHP Класс Flarum\Core\Notification

A notification record is associated with a user, and shows up in their notification list. A notification indicates that something has happened that the user should know about, like if a user's discussion was renamed by someone else. Each notification record has a *type*. The type determines how the record looks in the notifications list, and what *subject* is associated with it. For example, the 'discussionRenamed' notification type represents that someone renamed a user's discussion. Its subject is a discussion, of which the ID is stored in the subject_id column.
Наследование: extends Flarum\Database\AbstractModel
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$dates
$subjectModels array A map of notification types and the model classes to use for their subjects. For example, the 'discussionRenamed' notification type, which represents that a user's discussion was renamed, has the subject model class 'Flarum\Core\Discussion'.
$table

Открытые методы

Метод Описание
getDataAttribute ( string $value ) : mixed When getting the data attribute, unserialize the JSON stored in the database into a plain array.
getSubjectModelAttribute ( ) : string | null Get the subject model for this notification record by looking up its type in our subject model map.
getSubjectModels ( ) : array Get the type-to-subject-model map.
read ( ) : void Mark a notification as read.
sender ( ) : BelongsTo Define the relationship with the notification's sender.
setDataAttribute ( mixed $value ) When setting the data attribute, serialize it into JSON for storage in the database.
setSubjectModel ( string $type, string $subjectModel ) : void Set the subject model for the given notification type.
subject ( ) : Illuminate\Database\Eloquent\Relations\MorphTo Define the relationship with the notification's subject.
user ( ) : BelongsTo Define the relationship with the notification's recipient.

Описание методов

getDataAttribute() публичный Метод

When getting the data attribute, unserialize the JSON stored in the database into a plain array.
public getDataAttribute ( string $value ) : mixed
$value string
Результат mixed

getSubjectModelAttribute() публичный Метод

Get the subject model for this notification record by looking up its type in our subject model map.
public getSubjectModelAttribute ( ) : string | null
Результат string | null

getSubjectModels() публичный статический Метод

Get the type-to-subject-model map.
public static getSubjectModels ( ) : array
Результат array

read() публичный Метод

Mark a notification as read.
public read ( ) : void
Результат void

sender() публичный Метод

Define the relationship with the notification's sender.
public sender ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

setDataAttribute() публичный Метод

When setting the data attribute, serialize it into JSON for storage in the database.
public setDataAttribute ( mixed $value )
$value mixed

setSubjectModel() публичный статический Метод

Set the subject model for the given notification type.
public static setSubjectModel ( string $type, string $subjectModel ) : void
$type string The notification type.
$subjectModel string The class name of the subject model for that type.
Результат void

subject() публичный Метод

Define the relationship with the notification's subject.
public subject ( ) : Illuminate\Database\Eloquent\Relations\MorphTo
Результат Illuminate\Database\Eloquent\Relations\MorphTo

user() публичный Метод

Define the relationship with the notification's recipient.
public user ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

Описание свойств

$dates защищенное свойство

protected $dates

$subjectModels защищенное статическое свойство

A map of notification types and the model classes to use for their subjects. For example, the 'discussionRenamed' notification type, which represents that a user's discussion was renamed, has the subject model class 'Flarum\Core\Discussion'.
protected static array $subjectModels
Результат array

$table защищенное свойство

protected $table