abstract class AbstractEventPost extends Post

Traits

Properties

bool $timestamps Indicates if the model should be timestamped. Turn off by default. from AbstractModel
protected callable[] $afterSaveCallbacks An array of callbacks to be run once after the model is saved. from AbstractModel
protected callable[] $afterDeleteCallbacks An array of callbacks to be run once after the model is deleted. from AbstractModel
static $customRelations from AbstractModel
static $dateAttributes from AbstractModel
static $defaults from AbstractModel
protected array $pendingEvents from EventGeneratorTrait
protected $table from Post
protected array $dates The attributes that should be mutated to dates. from Post
protected array $casts The attributes that should be cast to native types. from Post
static protected array $models A map of post types, as specified in the <code>type</code> column, to their classes. from Post
string|null $type from Post
int $id from Post
int $discussion_id from Post
int $number from Post
Carbon $created_at from Post
int|null $user_id from Post
array $content
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

Methods

static 
boot()

{@inheritdoc}

from Post
__construct(array $attributes = [])

{@inheritdoc}

array
getDates()

Get the attributes that should be converted to dates.

mixed
getAttribute(string $key)

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

mixed
getCustomRelation(string $name)

Get a custom relation object.

void
afterSave(callable $callback)

Register a callback to be run once after the model is saved.

void
afterDelete(callable $callback)

Register a callback to be run once after the model is deleted.

callable[]
releaseAfterSaveCallbacks()

No description

callable[]
releaseAfterDeleteCallbacks()

No description

__call($method, $arguments)

{@inheritdoc}

raise(mixed $event)

Raise a new event.

array
releaseEvents()

Return and reset all pending events.

scopeWhereVisibleTo(Builder $query, User $actor)

Scope a query to only include records that are visible to a user.

bool
isVisibleTo(User $user)

Determine whether or not this post is visible to the given user.

from Post
BelongsTo
discussion()

Define the relationship with the post's discussion.

from Post
BelongsTo
user()

Define the relationship with the post's author.

from Post
BelongsTo
editedUser()

Define the relationship with the user who edited the post.

from Post
BelongsTo
hiddenUser()

Define the relationship with the user who hid the post.

from Post
Builder
scopeAllTypes(Builder $query)

Get all posts, regardless of their type, by removing the <code>RegisteredTypesScope</code> global scope constraints applied on this model.

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

Create a new model instance according to the post's type.

from Post
static array
getModels()

Get the type-to-model map.

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

Set the model for the given post type.

from Post
array
getContentAttribute(string $value)

Unserialize the content attribute from the database's JSON value.

setContentAttribute(string $value)

Serialize the content attribute to be stored in the database as JSON.

Details

static boot()

{@inheritdoc}

__construct(array $attributes = [])

{@inheritdoc}

Parameters

array $attributes

array getDates()

Get the attributes that should be converted to dates.

Return Value

array

mixed getAttribute(string $key)

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

Parameters

string $key

Return Value

mixed

protected mixed getCustomRelation(string $name)

Get a custom relation object.

Parameters

string $name

Return Value

mixed

void afterSave(callable $callback)

Register a callback to be run once after the model is saved.

Parameters

callable $callback

Return Value

void

void afterDelete(callable $callback)

Register a callback to be run once after the model is deleted.

Parameters

callable $callback

Return Value

void

callable[] releaseAfterSaveCallbacks()

Return Value

callable[]

callable[] releaseAfterDeleteCallbacks()

Return Value

callable[]

__call($method, $arguments)

{@inheritdoc}

Parameters

$method
$arguments

raise(mixed $event)

Raise a new event.

Parameters

mixed $event

array releaseEvents()

Return and reset all pending events.

Return Value

array

scopeWhereVisibleTo(Builder $query, User $actor)

Scope a query to only include records that are visible to a user.

Parameters

Builder $query
User $actor

bool isVisibleTo(User $user)

Determine whether or not this post is visible to the given user.

Parameters

User $user

Return Value

bool

BelongsTo discussion()

Define the relationship with the post's discussion.

Return Value

BelongsTo

BelongsTo user()

Define the relationship with the post's author.

Return Value

BelongsTo

BelongsTo editedUser()

Define the relationship with the user who edited the post.

Return Value

BelongsTo

BelongsTo hiddenUser()

Define the relationship with the user who hid the post.

Return Value

BelongsTo

Builder scopeAllTypes(Builder $query)

Get all posts, regardless of their type, by removing the <code>RegisteredTypesScope</code> global scope constraints applied on this model.

Parameters

Builder $query

Return Value

Builder

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

Create a new model instance according to the post's type.

Parameters

array $attributes
string|null $connection

Return Value

Post|object

static array getModels()

Get the type-to-model map.

Return Value

array

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

Set the model for the given post type.

Parameters

string $type The post type.
string $model The class name of the model for that type.

Return Value

void

array getContentAttribute(string $value)

Unserialize the content attribute from the database's JSON value.

Parameters

string $value

Return Value

array

setContentAttribute(string $value)

Serialize the content attribute to be stored in the database as JSON.

Parameters

string $value