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
static $customRelations from AbstractModel
static $customCasts from AbstractModel
static $defaults from AbstractModel
protected $tableAlias <p>An alias for the table name, used in queries.</p> from AbstractModel
protected $pendingEvents from EventGeneratorTrait
static protected $visibilityScopers from ScopeVisibilityTrait
protected $table from Post
protected $casts from Post
static protected Post>> $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|Expression $number from Post
Carbon $created_at from Post
int|null $user_id from Post
array $content from AbstractEventPost
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
string $ip_address from Post
bool $is_private from Post
Discussion|null $discussion from Post
User|null $user from Post
User|null $editedUser from Post
User|null $hiddenUser from Post

Methods

static 
boot()

No description

from Post
__construct(array $attributes = [])

No description

array
getCasts()

No description

getAttribute($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>

array
releaseAfterSaveCallbacks()

No description

array
releaseAfterDeleteCallbacks()

No description

__call($method, $parameters)

No description

newModelQuery()

No description

qualifyColumn($column)

No description

mixed
withTableAlias(callable $callback)

No description

newCollection(array $models = [])

No description

__sleep()

No description

void
raise(object $event)

No description

array
releaseEvents()

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

static void
registerVisibilityScoper(callable $scoper, string|null $ability = null)

No description

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

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

static Builder
whereVisibleTo(User $user)

No description

bool
isVisibleTo(User $user)

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

from Post
BelongsTo
discussion()

No description

from Post
BelongsTo
user()

No description

from Post
BelongsTo
editedUser()

No description

from Post
BelongsTo
hiddenUser()

No description

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

No description

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

No description

from Post
array|null
getContentAttribute(string $value)

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

void
setContentAttribute(mixed $value)

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

saveAfter(Post $previous = null)

<p>Save the model, given that it is going to appear immediately after the passed model.</p>

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

No description

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

No description

Details

static boot()

__construct(array $attributes = [])

Parameters

array $attributes

array getCasts()

Return Value

array

getAttribute($key)

<p>Get an attribute from the model. If nothing is found, attempt to load a custom relation method with this key.</p>

Parameters

$key

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

array releaseAfterSaveCallbacks()

Return Value

array

array releaseAfterDeleteCallbacks()

Return Value

array

__call($method, $parameters)

Parameters

$method
$parameters

newModelQuery()

qualifyColumn($column)

Parameters

$column

mixed withTableAlias(callable $callback)

Parameters

callable $callback

Return Value

mixed

Collection newCollection(array $models = [])

Parameters

array $models

Return Value

Collection

__sleep()

void raise(object $event)

Parameters

object $event

Return Value

void

array releaseEvents()

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

Return Value

array

static void registerVisibilityScoper(callable $scoper, string|null $ability = null)

Parameters

callable $scoper
string|null $ability

Return Value

void

Builder 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

Return Value

Builder

static Builder whereVisibleTo(User $user)

Parameters

User $user

Return Value

Builder

bool isVisibleTo(User $user)

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

Parameters

User $user

Return Value

bool

BelongsTo discussion()

Return Value

BelongsTo

BelongsTo user()

Return Value

BelongsTo

BelongsTo editedUser()

Return Value

BelongsTo

BelongsTo hiddenUser()

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

Return Value

array

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

Parameters

string $type
string $model

Return Value

void

array|null getContentAttribute(string $value)

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

Parameters

string $value

Return Value

array|null

void setContentAttribute(mixed $value)

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

Parameters

mixed $value

Return Value

void

MergeableInterface saveAfter(Post $previous = null)

<p>Save the model, given that it is going to appear immediately after the passed model.</p>

Parameters

Post $previous

Return Value

MergeableInterface <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)

Parameters

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

Return Value

DiscussionRenamedPost

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

Parameters

string $oldTitle
string $newTitle

Return Value

array