Documentation

Comment extends Model
in package
Uses Encryptable, SoftDelete, Timezonable

Clake\Userextended\Models\Comment

Tags
mixin

\Eloquent

Table of Contents

$attachMany  : mixed
$attachOne  : mixed
$author_id  : int
$belongsTo  : mixed
$belongsToMany  : mixed
$content  : string
$created_at  : Carbon|null
$deleted_at  : Carbon|null
$hasMany  : mixed
$hasOne  : array<string|int, mixed>
$id  : int
$morphMany  : mixed
$morphOne  : mixed
$morphTo  : mixed
$table  : string
$updated_at  : Carbon|null
$user_id  : int
$dates  : mixed
$encryptable  : mixed
$encrypter  : Encrypter
$fillable  : array<string|int, mixed>
$forceDeleting  : bool
Indicates if the model is currently force deleting.
$guarded  : array<string|int, mixed>
$originalEncryptableValues  : array<string|int, mixed>
$timezonable  : mixed
all()  :
author()  :
bootEncryptable()  : void
Boot the encryptable trait for a model.
bootSoftDelete()  : void
Boot the soft deleting trait for a model.
bootTimezonable()  : mixed
Called by the system on runtime, Binds an event to the model to adjust timezones
forceDelete()  : void
Force a hard delete on a soft deleted model.
get()  :
getDeletedAtColumn()  : string
Get the name of the "deleted at" column.
getEncryptableAttributes()  : array<string|int, mixed>
Returns a collection of fields that will be encrypted.
getEncryptableValue()  : string
Decrypts an attribute value
getEncrypter()  : Encrypter
Provides the encrypter instance.
getOriginalEncryptableValue()  : mixed
Returns the original values of any encrypted attributes.
getOriginalEncryptableValues()  : array<string|int, mixed>
Returns the original values of any encrypted attributes.
getQualifiedDeletedAtColumn()  : string
Get the fully qualified "deleted at" column.
getTime()  : mixed
Returns a timestamp adjusted by the logged in users Timezone
getTimezonableAttributes()  : array<string|int, mixed>
Returns a collection of fields that will be encrypted.
id()  :
isAuthor()  : bool
Determines whether or not the passed in userId is the writer of the comment
isSoftDelete()  : bool
Helper method to check if the model is currently being hard or soft deleted, useful in events.
isUser()  : bool
Returns whether the passed in user is the recipient of a comment
makeEncryptableValue()  : string
Encrypts an attribute value and saves it in the original locker.
newModelQuery()  :
newQuery()  :
onlyTrashed()  : Builder|static
Get a new query builder that only includes soft deletes.
query()  :
restore()  : bool|null
Restore a soft-deleted model instance.
restored()  : void
Register a restored model event with the dispatcher.
restoring()  : void
Register a restoring model event with the dispatcher.
scopeAuthor()  : mixed
Gets a comment's author
scopeId()  : mixed
Gets a comment based upon a passed in commentId
scopeUser()  : mixed
Gets a comments recipient
setEncrypter()  : void
Sets the encrypter instance.
timezonify()  : mixed
Returns a timestamp adjusted by the logged in users Timezone Alias for getTime()
trashed()  : bool
Determine if the model instance has been soft-deleted.
user()  :
whereAuthorId()  :
whereContent()  :
whereCreatedAt()  :
whereDeletedAt()  :
whereId()  :
whereUpdatedAt()  :
whereUserId()  :
withTrashed()  : Builder|static
Get a new query builder that includes soft deletes.
performDeleteOnModel()  : mixed
Perform the actual delete query on this model instance.
performRestoreOnRelations()  : void
Locates relations with softDelete flag and cascades the restore event.
performSoftDeleteOnRelations()  : void
Locates relations with softDelete flag and cascades the delete event.
runSoftDelete()  : void
Perform the actual delete query on this model instance.

Properties

$attachMany

public mixed $attachMany = []

$attachOne

public mixed $attachOne = []

$belongsTo

public mixed $belongsTo = ['user' => ['Clake\Userextended\Models\UserExtended', 'key' => 'user_id'], 'author' => ['Clake\Userextended\Models\UserExtended', 'key' => 'author_id']]

$belongsToMany

public mixed $belongsToMany = []

$hasOne

public array<string|int, mixed> $hasOne = []

Relations

$morphMany

public mixed $morphMany = []

$morphOne

public mixed $morphOne = []

$table

public string $table = 'clake_userextended_comments'

The database table used by the model.

$dates

protected mixed $dates = ['deleted_at']

$encryptable

protected mixed $encryptable = ['content']

$fillable

protected array<string|int, mixed> $fillable = ['content', 'user_id', 'author_id']

Fillable fields

$forceDeleting

Indicates if the model is currently force deleting.

protected bool $forceDeleting = false

$guarded

protected array<string|int, mixed> $guarded = ['*']

Guarded fields

$originalEncryptableValues

protected array<string|int, mixed> $originalEncryptableValues = []

List of original attribute values before they were encrypted.

$timezonable

protected mixed $timezonable = ['created_at', 'updated_at']

Methods

all()

public static all(mixed $columns) :
Parameters
$columns : mixed
Return values

author()

public static author() :
Return values

bootEncryptable()

Boot the encryptable trait for a model.

public static bootEncryptable() : void
Return values
void

bootSoftDelete()

Boot the soft deleting trait for a model.

public static bootSoftDelete() : void
Return values
void

bootTimezonable()

Called by the system on runtime, Binds an event to the model to adjust timezones

public static bootTimezonable() : mixed
Tags
throws
Exception
Return values
mixed

forceDelete()

Force a hard delete on a soft deleted model.

public forceDelete() : void
Return values
void

get()

public static get(mixed $columns) :
Parameters
$columns : mixed
Return values

getDeletedAtColumn()

Get the name of the "deleted at" column.

public getDeletedAtColumn() : string
Return values
string

getEncryptableAttributes()

Returns a collection of fields that will be encrypted.

public getEncryptableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEncryptableValue()

Decrypts an attribute value

public getEncryptableValue(string $key) : string
Parameters
$key : string

Attribute

Return values
string

Decrypted value

getOriginalEncryptableValue()

Returns the original values of any encrypted attributes.

public getOriginalEncryptableValue(mixed $attribute) : mixed
Parameters
$attribute : mixed
Return values
mixed

getOriginalEncryptableValues()

Returns the original values of any encrypted attributes.

public getOriginalEncryptableValues() : array<string|int, mixed>
Return values
array<string|int, mixed>

getQualifiedDeletedAtColumn()

Get the fully qualified "deleted at" column.

public getQualifiedDeletedAtColumn() : string
Return values
string

getTime()

Returns a timestamp adjusted by the logged in users Timezone

public getTime( $timestamp[, UserExtended|null $user = null ]) : mixed
Parameters
$timestamp :
$user : UserExtended|null = null
Return values
mixed

getTimezonableAttributes()

Returns a collection of fields that will be encrypted.

public getTimezonableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

id()

public static id(mixed $commentId) :
Parameters
$commentId : mixed
Return values

isAuthor()

Determines whether or not the passed in userId is the writer of the comment

public isAuthor( $commentId,  $userId) : bool
Parameters
$commentId :
$userId :
Return values
bool

isSoftDelete()

Helper method to check if the model is currently being hard or soft deleted, useful in events.

public isSoftDelete() : bool
Return values
bool

isUser()

Returns whether the passed in user is the recipient of a comment

public isUser( $commentId,  $userId) : bool
Parameters
$commentId :
$userId :
Return values
bool

makeEncryptableValue()

Encrypts an attribute value and saves it in the original locker.

public makeEncryptableValue(string $key, string $value) : string
Parameters
$key : string

Attribute

$value : string

Value to encrypt

Return values
string

Encrypted value

newModelQuery()

public static newModelQuery() :
Return values

newQuery()

public static newQuery() :
Return values

onlyTrashed()

Get a new query builder that only includes soft deletes.

public static onlyTrashed() : Builder|static
Return values
Builder|static

query()

public static query() :
Return values

restore()

Restore a soft-deleted model instance.

public restore() : bool|null
Return values
bool|null

restored()

Register a restored model event with the dispatcher.

public static restored(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

restoring()

Register a restoring model event with the dispatcher.

public static restoring(Closure|string $callback) : void
Parameters
$callback : Closure|string
Return values
void

scopeAuthor()

Gets a comment's author

public scopeAuthor( $query) : mixed
Parameters
$query :
Return values
mixed

scopeId()

Gets a comment based upon a passed in commentId

public scopeId( $query,  $commentId) : mixed
Parameters
$query :
$commentId :
Return values
mixed

scopeUser()

Gets a comments recipient

public scopeUser( $query) : mixed
Parameters
$query :
Return values
mixed

setEncrypter()

Sets the encrypter instance.

public setEncrypter(Encrypter $encrypter) : void
Parameters
$encrypter : Encrypter
Return values
void

timezonify()

Returns a timestamp adjusted by the logged in users Timezone Alias for getTime()

public timezonify( $timestamp) : mixed
Parameters
$timestamp :
Return values
mixed

trashed()

Determine if the model instance has been soft-deleted.

public trashed() : bool
Return values
bool

user()

public static user() :
Return values

whereAuthorId()

public static whereAuthorId(mixed $value) :
Parameters
$value : mixed
Return values

whereContent()

public static whereContent(mixed $value) :
Parameters
$value : mixed
Return values

whereCreatedAt()

public static whereCreatedAt(mixed $value) :
Parameters
$value : mixed
Return values

whereDeletedAt()

public static whereDeletedAt(mixed $value) :
Parameters
$value : mixed
Return values

whereId()

public static whereId(mixed $value) :
Parameters
$value : mixed
Return values

whereUpdatedAt()

public static whereUpdatedAt(mixed $value) :
Parameters
$value : mixed
Return values

whereUserId()

public static whereUserId(mixed $value) :
Parameters
$value : mixed
Return values

withTrashed()

Get a new query builder that includes soft deletes.

public static withTrashed() : Builder|static
Return values
Builder|static

performDeleteOnModel()

Perform the actual delete query on this model instance.

protected performDeleteOnModel() : mixed
Return values
mixed

performRestoreOnRelations()

Locates relations with softDelete flag and cascades the restore event.

protected performRestoreOnRelations() : void
Return values
void

performSoftDeleteOnRelations()

Locates relations with softDelete flag and cascades the delete event.

protected performSoftDeleteOnRelations() : void
Return values
void

runSoftDelete()

Perform the actual delete query on this model instance.

protected runSoftDelete() : void
Return values
void

Search results