abstract class AbstractEventPost extends Post

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 $dateAttributes from AbstractModel
static $defaults from AbstractModel
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
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()

<p>{@inheritdoc}</p>

from Post
__construct(array $attributes = [])

<p>{@inheritdoc}</p>

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>

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
array
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>

Details

static boot()

<p>{@inheritdoc}</p>

__construct(array $attributes = [])

<p>{@inheritdoc}</p>

Parameters

array $attributes

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

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

array getContentAttribute(string $value)

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

Parameters

string $value

Return Value

array

setContentAttribute(string $value)

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

Parameters

string $value