class Comment extends Model (View source)

Traits

Methods to give a model a formatted text body.

Methods to manage reactions on a model.

HasRecursiveRelationships

Methods for models that have validation rules.

Broadcasts

Trait for models that notifications can be about.

Constants

UPDATED_AT

Properties

static protected $unguarded from  Model
static protected Formatter[] $formatters from  UsesFormatter
string $body
string $parsed_body

The intermediary parsed XML document.

from  HasBody
HtmlString read-only $body_html

The formatted HTML version of the body for the current user.

from  HasBody
string read-only $body_text

The parsed body with formatting removed.

from  HasBody
Collection read-only $mentions from  HasBody
Collection read-only $attachments from  HasBody
protected $casts
protected $hidden
int $id
int $post_id
null|int $parent_id
null|int $user_id
Carbon $created_at
null|Carbon $edited_at
int $reply_count
int $score
null|Carbon $hidden_at
null|int $hidden_by
null|string $hidden_reason
Post read-only $post
null|User read-only $user
Collection read-only $replies
null|Comment read-only $parent
null|User read-only $hiddenBy
string read-only $url
string read-only $edit_url
string read-only $post_url

Methods

getConnectionName()

No description

from  Model
HtmlString|string
format(string $attribute, User $user = null)

Render an attribute as HTML for the given user.

static Formatter
getFormatter(string $attribute)

Set a formatter instance for this model.

static void
setFormatter(string $attribute, Formatter $formatter)

Set a formatter instance for this model.

getAttribute($key)

No description

setAttribute($key, $value)

No description

static void
bootHasBody()

No description

from  HasBody
MorphToMany
mentions()

Relationship with the users who were mentioned in the body.

from  HasBody
MorphToMany
attachments()

Relationship with the uploads that were attached in the body.

from  HasBody
MorphMany
reactions()

Relationship with the reactions for this model.

reactionsSummary()

Relationship with a summary of the reactions for this model.

ReactionSet|null
reactionSet()

No description

recalculateScore()

Recalculate the score from the reactions.

static array
validate(array $data, ValidatesData $instance = null)

Validate an array of data against the model's validation rules.

static array
rules(Comment $instance = null)

No description

static array
messages(ValidatesData $instance = null)

The model's validation messages.

static array
customAttributes(ValidatesData $instance = null)

The model's validation custom attribute translations.

static void
bootNotificationContent()

No description

MorphMany
notifications()

Relationship with the notifications about this model.

MorphMany
groupedNotifications()

Relationship with the notifications grouped by this model.

static void
booted()

No description

BelongsTo
post()

No description

BelongsTo
user()

No description

HasMany
replies()

No description

BelongsTo
parent()

No description

BelongsTo
hiddenBy()

No description

bool
isUnread()

Determine whether this comment is unread by the current user.

bool
isRead()

Determine whether this comment is read by the current user.

bool
isAnswer()

Determine whether this comment has been marked as the answer.

bool
isHidden()

Determine whether this comment has been hidden.

markAsEdited()

Mark this comment as having been edited just now.

refreshReplyMetadata()

Refresh the metadata about this comment's replies.

int
getPerPage()

No description

array
streamUpdated()

Get the Turbo Streams that should be sent when this comment is updated.

array
streamRemoved()

Get the Turbo Streams that should be sent when this comment is removed.

Attribute
url()

No description

Attribute
editUrl()

No description

Attribute
postUrl()

No description

string
reactionsUrl(ReactionType $reactionType)

No description

Details

getConnectionName()

No description

HtmlString|string format(string $attribute, User $user = null)

Render an attribute as HTML for the given user.

Parameters

string $attribute
User $user

Return Value

HtmlString|string

static Formatter getFormatter(string $attribute)

Set a formatter instance for this model.

Parameters

string $attribute

Return Value

Formatter

static void setFormatter(string $attribute, Formatter $formatter)

Set a formatter instance for this model.

Parameters

string $attribute
Formatter $formatter

Return Value

void

getAttribute($key)

No description

Parameters

$key

setAttribute($key, $value)

No description

Parameters

$key
$value

static void bootHasBody()

No description

Return Value

void

MorphToMany mentions()

Relationship with the users who were mentioned in the body.

Return Value

MorphToMany

MorphToMany attachments()

Relationship with the uploads that were attached in the body.

Return Value

MorphToMany

MorphMany reactions()

Relationship with the reactions for this model.

Return Value

MorphMany

ReactionsSummaryRelation reactionsSummary()

Relationship with a summary of the reactions for this model.

This is less expensive to load than all of the actual reactions.

ReactionSet|null reactionSet()

No description

Return Value

ReactionSet|null

Reactable recalculateScore()

Recalculate the score from the reactions.

Return Value

Reactable

static array validate(array $data, ValidatesData $instance = null)

Validate an array of data against the model's validation rules.

Parameters

array $data
ValidatesData $instance

Return Value

array

static array rules(Comment $instance = null)

No description

Parameters

Comment $instance

Return Value

array

static protected array messages(ValidatesData $instance = null)

The model's validation messages.

Parameters

ValidatesData $instance

Return Value

array

static protected array customAttributes(ValidatesData $instance = null)

The model's validation custom attribute translations.

Parameters

ValidatesData $instance

Return Value

array

static void bootNotificationContent()

No description

Return Value

void

MorphMany notifications()

Relationship with the notifications about this model.

Return Value

MorphMany

MorphMany groupedNotifications()

Relationship with the notifications grouped by this model.

Return Value

MorphMany

static protected void booted()

No description

Return Value

void

BelongsTo post()

No description

Return Value

BelongsTo

BelongsTo user()

No description

Return Value

BelongsTo

HasMany replies()

No description

Return Value

HasMany

BelongsTo parent()

No description

Return Value

BelongsTo

BelongsTo hiddenBy()

No description

Return Value

BelongsTo

bool isUnread()

Determine whether this comment is unread by the current user.

Return Value

bool

bool isRead()

Determine whether this comment is read by the current user.

Return Value

bool

bool isAnswer()

Determine whether this comment has been marked as the answer.

Return Value

bool

bool isHidden()

Determine whether this comment has been hidden.

Return Value

bool

Comment markAsEdited()

Mark this comment as having been edited just now.

Return Value

Comment

Comment refreshReplyMetadata()

Refresh the metadata about this comment's replies.

Return Value

Comment

int getPerPage()

No description

Return Value

int

array streamUpdated()

Get the Turbo Streams that should be sent when this comment is updated.

Return Value

array

array streamRemoved()

Get the Turbo Streams that should be sent when this comment is removed.

Return Value

array

protected Attribute url()

No description

Return Value

Attribute

protected Attribute editUrl()

No description

Return Value

Attribute

protected Attribute postUrl()

No description

Return Value

Attribute

string reactionsUrl(ReactionType $reactionType)

No description

Parameters

ReactionType $reactionType

Return Value

string