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
파일 보기 프로젝트 열기: flarum/core 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$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