class CommentPost extends Post
A standard comment in a discussion.
Traits
Properties
bool | $timestamps | <p>Indicates if the model should be timestamped. Turn off by default.</p> | from AbstractModel | |
protected callable[] | $afterSaveCallbacks | <p>An array of callbacks to be run once after the model is saved.</p> | from AbstractModel | |
protected callable[] | $afterDeleteCallbacks | <p>An array of callbacks to be run once after the model is deleted.</p> | from AbstractModel | |
static | $customRelations | from AbstractModel | ||
static | $customCasts | from AbstractModel | ||
static | $defaults | from AbstractModel | ||
protected string|null | $tableAlias | <p>An alias for the table name, used in queries.</p> | from AbstractModel | |
int | $id | from Post | ||
protected array | $pendingEvents | from EventGeneratorTrait | ||
static protected | $visibilityScopers | from ScopeVisibilityTrait | ||
protected | $table | from Post | ||
protected array | $dates | <p>The attributes that should be mutated to dates.</p> | from Post | |
protected array | $casts | <p>The attributes that should be cast to native types.</p> | from Post | |
static protected array | $models | <p>A map of post types, as specified in the <code>type</code> column, to their classes.</p> | from Post | |
static | $type | <p>{@inheritdoc}</p> | ||
int | $discussion_id | from Post | ||
int|Expression | $number | from Post | ||
Carbon | $created_at | from Post | ||
int|null | $user_id | from Post | ||
string|null | $content | from Post | ||
Carbon|null | $edited_at | from Post | ||
int|null | $edited_user_id | from Post | ||
$hidden_at | from Post | |||
$hidden_user_id | from Post | |||
Discussion|null | $discussion | from Post | ||
User|null | $user | from Post | ||
User|null | $editedUser | from Post | ||
$hiddenUser | from Post | |||
string | $ip_address | from Post | ||
bool | $is_private | from Post | ||
static protected Formatter | $formatter | <p>The text formatter instance.</p> | ||
string | $parsed_content |
Methods
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
<p>Register a callback to be run once after the model is saved.</p>
<p>Register a callback to be run once after the model is deleted.</p>
<p>Scope a query to only include records that are visible to a user.</p>
<p>Get all posts, regardless of their type, by removing the <code>RegisteredTypesScope</code> global scope constraints applied on this model.</p>
<p>Create a new model instance according to the post's type.</p>
<p>Set the model for the given post type.</p>
<p>Parse the content before it is saved to the database.</p>
<p>Get the content rendered as HTML.</p>
Details
in AbstractModel
at
line 97
__construct(array $attributes = [])
<p>{@inheritdoc}</p>
in AbstractModel
at
line 115
getCasts()
<p>{@inheritdoc}</p>
in AbstractModel
at
line 133
mixed
getAttribute(string $key)
<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>
in AbstractModel
at
line 159
protected mixed
getCustomRelation(string $name)
<p>Get a custom relation object.</p>
in AbstractModel
at
line 175
void
afterSave(callable $callback)
<p>Register a callback to be run once after the model is saved.</p>
in AbstractModel
at
line 186
void
afterDelete(callable $callback)
<p>Register a callback to be run once after the model is deleted.</p>
in AbstractModel
at
line 194
callable[]
releaseAfterSaveCallbacks()
in AbstractModel
at
line 206
callable[]
releaseAfterDeleteCallbacks()
in AbstractModel
at
line 218
__call($method, $arguments)
<p>{@inheritdoc}</p>
in AbstractModel
at
line 227
newModelQuery()
in AbstractModel
at
line 238
qualifyColumn($column)
in AbstractModel
at
line 247
withTableAlias(callable $callback)
in AbstractModel
at
line 262
newCollection(Collection|array $models = [])
in EventGeneratorTrait
at
line 24
raise(mixed $event)
<p>Raise a new event.</p>
in EventGeneratorTrait
at
line 34
array
releaseEvents()
<p>Return and reset all pending events.</p>
in ScopeVisibilityTrait
at
line 20
static
registerVisibilityScoper($scoper, $ability = null)
in ScopeVisibilityTrait
at
line 41
scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')
<p>Scope a query to only include records that are visible to a user.</p>
bool
isVisibleTo(User $user)
<p>Determine whether or not this post is visible to the given user.</p>
BelongsTo
discussion()
<p>Define the relationship with the post's discussion.</p>
BelongsTo
editedUser()
<p>Define the relationship with the user who edited the post.</p>
BelongsTo
hiddenUser()
<p>Define the relationship with the user who hid the post.</p>
Builder
scopeAllTypes(Builder $query)
<p>Get all posts, regardless of their type, by removing the <code>RegisteredTypesScope</code> global scope constraints applied on this model.</p>
Post|object
newFromBuilder(array $attributes = [], string|null $connection = null)
<p>Create a new model instance according to the post's type.</p>
static void
setModel(string $type, string $model)
<p>Set the model for the given post type.</p>
at
line 50
static CommentPost
reply(int $discussionId, string $content, int $userId, string $ipAddress, User $actor = null)
<p>Create a new instance in reply to a discussion.</p>
at
line 114
$this
restore()
<p>Restore the post.</p>
at
line 132
string
getContentAttribute(string $value)
<p>Unparse the parsed content.</p>
at
line 142
string
getParsedContentAttribute()
<p>Get the parsed/raw content.</p>
at
line 153
setContentAttribute(string $value, User $actor = null)
<p>Parse the content before it is saved to the database.</p>
at
line 163
setParsedContentAttribute(string $value)
<p>Set the parsed/raw content.</p>
at
line 174
string
formatContent(ServerRequestInterface $request = null)
<p>Get the content rendered as HTML.</p>