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
Carbon|null $hidden_at from Post
int|null $hidden_user_id from Post
Discussion|null $discussion from Post
User|null $user from Post
User|null $editedUser from Post
User|null $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

static 
boot()

<p>{@inheritdoc}</p>

from Post
__construct(array $attributes = [])

<p>{@inheritdoc}</p>

getCasts()

<p>{@inheritdoc}</p>

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>

mixed
getCustomRelation(string $name)

<p>Get a custom relation object.</p>

void
afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

void
afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

<p>{@inheritdoc}</p>

newModelQuery()

No description

qualifyColumn($column)

No description

withTableAlias(callable $callback)

No description

newCollection(Collection|array $models = [])

No description

raise(mixed $event)

<p>Raise a new event.</p>

array
releaseEvents()

<p>Return and reset all pending events.</p>

static 
registerVisibilityScoper($scoper, $ability = null)

No description

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>

from Post
BelongsTo
discussion()

<p>Define the relationship with the post's discussion.</p>

from Post
BelongsTo
user()

<p>Define the relationship with the post's author.</p>

from Post
BelongsTo
editedUser()

<p>Define the relationship with the user who edited the post.</p>

from Post
BelongsTo
hiddenUser()

<p>Define the relationship with the user who hid the post.</p>

from Post
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>

from Post
Post|object
newFromBuilder(array $attributes = [], string|null $connection = null)

<p>Create a new model instance according to the post's type.</p>

from Post
static array
getModels()

<p>Get the type-to-model map.</p>

from Post
static void
setModel(string $type, string $model)

<p>Set the model for the given post type.</p>

from Post
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>

$this
revise(string $content, User $actor)

<p>Revise the post's content.</p>

$this
hide(User $actor = null)

<p>Hide the post.</p>

$this
restore()

<p>Restore the post.</p>

string
getContentAttribute(string $value)

<p>Unparse the parsed content.</p>

string
getParsedContentAttribute()

<p>Get the parsed/raw content.</p>

setContentAttribute(string $value, User $actor = null)

<p>Parse the content before it is saved to the database.</p>

setParsedContentAttribute(string $value)

<p>Set the parsed/raw content.</p>

string
formatContent(ServerRequestInterface $request = null)

<p>Get the content rendered as HTML.</p>

static Formatter
getFormatter()

<p>Get the text formatter instance.</p>

static 
setFormatter(Formatter $formatter)

<p>Set the text formatter instance.</p>

Details

static boot()

<p>{@inheritdoc}</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

Parameters

array $attributes

getCasts()

<p>{@inheritdoc}</p>

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>

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

<p>Get a custom relation object.</p>

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

<p>Register a callback to be run once after the model is saved.</p>

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

<p>Register a callback to be run once after the model is deleted.</p>

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

<p>{@inheritdoc}</p>

Parameters

$method
$arguments

newModelQuery()

qualifyColumn($column)

Parameters

$column

withTableAlias(callable $callback)

Parameters

callable $callback

newCollection(Collection|array $models = [])

Parameters

Collection|array $models

raise(mixed $event)

<p>Raise a new event.</p>

Parameters

mixed $event

array releaseEvents()

<p>Return and reset all pending events.</p>

Return Value

array

static registerVisibilityScoper($scoper, $ability = null)

Parameters

$scoper
$ability

scopeWhereVisibleTo(Builder $query, User $actor, string $ability = 'view')

<p>Scope a query to only include records that are visible to a user.</p>

Parameters

Builder $query
User $actor
string $ability

bool isVisibleTo(User $user)

<p>Determine whether or not this post is visible to the given user.</p>

Parameters

User $user

Return Value

bool

BelongsTo discussion()

<p>Define the relationship with the post's discussion.</p>

Return Value

BelongsTo

BelongsTo user()

<p>Define the relationship with the post's author.</p>

Return Value

BelongsTo

BelongsTo editedUser()

<p>Define the relationship with the user who edited the post.</p>

Return Value

BelongsTo

BelongsTo hiddenUser()

<p>Define the relationship with the user who hid the post.</p>

Return Value

BelongsTo

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>

Parameters

Builder $query

Return Value

Builder

Post|object newFromBuilder(array $attributes = [], string|null $connection = null)

<p>Create a new model instance according to the post's type.</p>

Parameters

array $attributes
string|null $connection

Return Value

Post|object

static array getModels()

<p>Get the type-to-model map.</p>

Return Value

array

static void setModel(string $type, string $model)

<p>Set the model for the given post type.</p>

Parameters

string $type <p>The post type.</p>
string $model <p>The class name of the model for that type.</p>

Return Value

void

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>

Parameters

int $discussionId
string $content
int $userId
string $ipAddress
User $actor

Return Value

CommentPost

$this revise(string $content, User $actor)

<p>Revise the post's content.</p>

Parameters

string $content
User $actor

Return Value

$this

$this hide(User $actor = null)

<p>Hide the post.</p>

Parameters

User $actor

Return Value

$this

$this restore()

<p>Restore the post.</p>

Return Value

$this

string getContentAttribute(string $value)

<p>Unparse the parsed content.</p>

Parameters

string $value

Return Value

string

string getParsedContentAttribute()

<p>Get the parsed/raw content.</p>

Return Value

string

setContentAttribute(string $value, User $actor = null)

<p>Parse the content before it is saved to the database.</p>

Parameters

string $value
User $actor

setParsedContentAttribute(string $value)

<p>Set the parsed/raw content.</p>

Parameters

string $value

string formatContent(ServerRequestInterface $request = null)

<p>Get the content rendered as HTML.</p>

Parameters

ServerRequestInterface $request

Return Value

string

static Formatter getFormatter()

<p>Get the text formatter instance.</p>

Return Value

Formatter

static setFormatter(Formatter $formatter)

<p>Set the text formatter instance.</p>

Parameters

Formatter $formatter