class DiscussionRenamedPost extends AbstractEventPost implements MergeableInterface

A post which indicates that a discussion's title was changed.

The content is stored as a sequential array containing the old title and the new title.

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
protected array $pendingEvents from EventGeneratorTrait
protected $table <p>{@inheritdoc}</p> from Post
protected $dates <p>{@inheritdoc}</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
int $id from Post
int $discussion_id from Post
int $number from Post
Carbon $time from Post
int|null $user_id from Post
string|null $content from Post
Carbon|null $edit_time from Post
int|null $edit_user_id from Post
Carbon|null $hide_time from Post
int|null $hide_user_id from Post
Discussion|null $discussion from Post
User|null $user from Post
User|null $editUser from Post
User|null $hideUser from Post

Methods

static 
boot()

<p>{@inheritdoc}</p>

from Post
array
getDates()

<p>Get the attributes that should be converted to dates.</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>

raise(mixed $event)

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

array
releaseEvents()

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

scopeWhereVisibleTo(Builder $query, User $actor)

<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
editUser()

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

from Post
BelongsTo
hideUser()

<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
string
getContentAttribute(string $value)

<p>Unserialize the content attribute from the database's JSON value.</p>

setContentAttribute(string $value)

<p>Serialize the content attribute to be stored in the database as JSON.</p>

saveAfter(Post $previous)

No description

reply(int $discussionId, int $userId, string $oldTitle, string $newTitle)

<p>Create a new instance in reply to a discussion.</p>

static array
buildContent(string $oldTitle, string $newTitle)

<p>Build the content attribute.</p>

Details

static boot()

<p>{@inheritdoc}</p>

array getDates()

<p>Get the attributes that should be converted to dates.</p>

Return Value

array

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

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

scopeWhereVisibleTo(Builder $query, User $actor)

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

Parameters

Builder $query
User $actor

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 editUser()

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

Return Value

BelongsTo

BelongsTo hideUser()

<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

string getContentAttribute(string $value)

<p>Unserialize the content attribute from the database's JSON value.</p>

Parameters

string $value

Return Value

string

setContentAttribute(string $value)

<p>Serialize the content attribute to be stored in the database as JSON.</p>

Parameters

string $value

Post saveAfter(Post $previous)

Parameters

Post $previous

Return Value

Post <p>The model resulting after the merge. If the merge is unsuccessful, this should be the current model instance. Otherwise, it should be the model that was merged into.</p>

static DiscussionRenamedPost reply(int $discussionId, int $userId, string $oldTitle, string $newTitle)

<p>Create a new instance in reply to a discussion.</p>

Parameters

int $discussionId
int $userId
string $oldTitle
string $newTitle

Return Value

DiscussionRenamedPost

static protected array buildContent(string $oldTitle, string $newTitle)

<p>Build the content attribute.</p>

Parameters

string $oldTitle <p>The old title of the discussion.</p>
string $newTitle <p>The new title of the discussion.</p>

Return Value

array