Documentation

DatabaseNotification extends Model
in package

Table of Contents

CREATED_AT  = 'created_at'
The name of the "created at" column.
UPDATED_AT  = 'updated_at'
The name of the "updated at" column.
$exists  : bool
Indicates if the model exists.
$incrementing  : bool
Indicates if the IDs are auto-incrementing.
$manyMethods  : array<string|int, mixed>
The many to many relationship methods.
$snakeAttributes  : bool
Indicates whether attributes are snake cased on arrays.
$timestamps  : bool
Indicates if the model should be timestamped.
$wasRecentlyCreated  : bool
Indicates if the model was inserted during the current request lifecycle.
$appends  : array<string|int, mixed>
The accessors to append to the model's array form.
$attributes  : array<string|int, mixed>
The model's attributes.
$booted  : array<string|int, mixed>
The array of booted models.
$casts  : array<string|int, mixed>
The attributes that should be cast to native types.
$changes  : array<string|int, mixed>
The changed model attributes.
$connection  : string
The connection name for the model.
$dateFormat  : string
The storage format of the model's date columns.
$dates  : array<string|int, mixed>
The attributes that should be mutated to dates.
$dispatcher  : Dispatcher
The event dispatcher instance.
$dispatchesEvents  : array<string|int, mixed>
The event map for the model.
$fillable  : array<string|int, mixed>
The attributes that are mass assignable.
$globalScopes  : array<string|int, mixed>
The array of global scopes on the model.
$guardableColumns  : array<string|int, mixed>
The actual columns that exist on the database and can be guarded.
$guarded  : array<string|int, mixed>
The guarded attributes on the model.
$hidden  : array<string|int, mixed>
The attributes that should be hidden for serialization.
$keyType  : string
The "type" of the auto-incrementing ID.
$mutatorCache  : array<string|int, mixed>
The cache of the mutated attributes for each class.
$observables  : array<string|int, mixed>
User exposed observable events.
$original  : array<string|int, mixed>
The model attribute's original state.
$perPage  : int
The number of models to return for pagination.
$primaryKey  : string
The primary key for the model.
$relations  : array<string|int, mixed>
The loaded relationships for the model.
$resolver  : ConnectionResolverInterface
The connection resolver instance.
$table  : string
The table associated with the model.
$touches  : array<string|int, mixed>
The relationships that should be touched on save.
$unguarded  : bool
Indicates if all mass assignment is enabled.
$visible  : array<string|int, mixed>
The attributes that should be visible in serialization.
$with  : array<string|int, mixed>
The relations to eager load on every query.
$withCount  : array<string|int, mixed>
The relationship counts that should be eager loaded on every query.
__call()  : mixed
Handle dynamic method calls into the model.
__callStatic()  : mixed
Handle dynamic static method calls into the method.
__construct()  : void
Create a new Eloquent model instance.
__get()  : mixed
Dynamically retrieve attributes on the model.
__isset()  : bool
Determine if an attribute or relation exists on the model.
__set()  : void
Dynamically set attributes on the model.
__toString()  : string
Convert the model to its string representation.
__unset()  : void
Unset an attribute on the model.
__wakeup()  : void
When a model is being unserialized, check if it needs to be booted.
addGlobalScope()  : mixed
Register a new global scope on the model.
addHidden()  : void
Add hidden attributes for the model.
addObservableEvents()  : void
Add an observable event name.
addVisible()  : void
Add visible attributes for the model.
all()  : Collection|array<string|int, static>
Get all of the models from the database.
append()  : $this
Append attributes to query when building a query.
attributesToArray()  : array<string|int, mixed>
Convert the model's attributes to an array.
belongsTo()  : BelongsTo
Define an inverse one-to-one or many relationship.
belongsToMany()  : BelongsToMany
Define a many-to-many relationship.
cacheMutatedAttributes()  : void
Extract and cache all the mutated attributes of a class.
clearBootedModels()  : void
Clear the list of booted models so they will be re-booted.
created()  : void
Register a created model event with the dispatcher.
creating()  : void
Register a creating model event with the dispatcher.
delete()  : bool|null
Delete the model from the database.
deleted()  : void
Register a deleted model event with the dispatcher.
deleting()  : void
Register a deleting model event with the dispatcher.
destroy()  : int
Destroy the models for the given IDs.
fill()  : $this
Fill the model with an array of attributes.
fillable()  : $this
Set the fillable attributes for the model.
fillJsonAttribute()  : $this
Set a given JSON attribute on the model.
flushEventListeners()  : void
Remove all of the event listeners for the model.
forceDelete()  : bool|null
Force a hard delete on a soft deleted model.
forceFill()  : $this
Fill the model with an array of attributes. Force mass assignment.
fresh()  : static|null
Reload a fresh model instance from the database.
freshTimestamp()  : Carbon
Get a fresh timestamp for the model.
freshTimestampString()  : string
Get a fresh timestamp for the model.
fromDateTime()  : string
Convert a DateTime to a storable string.
fromJson()  : mixed
Decode the given JSON back into an array or object.
getActualClassNameForMorph()  : string
Retrieve the actual class name for a given morph class.
getAttribute()  : mixed
Get an attribute from the model.
getAttributes()  : array<string|int, mixed>
Get all of the current attributes on the model.
getAttributeValue()  : mixed
Get a plain attribute (not a relationship).
getCasts()  : array<string|int, mixed>
Get the casts array.
getChanges()  : array<string|int, mixed>
Get the attributes that were changed.
getConnection()  : Connection
Get the database connection for the model.
getConnectionName()  : string
Get the current connection name for the model.
getConnectionResolver()  : ConnectionResolverInterface
Get the connection resolver instance.
getCreatedAtColumn()  : string
Get the name of the "created at" column.
getDates()  : array<string|int, mixed>
Get the attributes that should be converted to dates.
getDirty()  : array<string|int, mixed>
Get the attributes that have been changed since last sync.
getEventDispatcher()  : Dispatcher
Get the event dispatcher instance.
getFillable()  : array<string|int, mixed>
Get the fillable attributes for the model.
getForeignKey()  : string
Get the default foreign key name for the model.
getGlobalScope()  : Scope|Closure|null
Get a global scope registered with the model.
getGlobalScopes()  : array<string|int, mixed>
Get the global scopes for this class instance.
getGuarded()  : array<string|int, mixed>
Get the guarded attributes for the model.
getHidden()  : array<string|int, mixed>
Get the hidden attributes for the model.
getIncrementing()  : bool
Get the value indicating whether the IDs are incrementing.
getKey()  : mixed
Get the value of the model's primary key.
getKeyName()  : string
Get the primary key for the model.
getKeyType()  : string
Get the auto-incrementing key type.
getMorphClass()  : string
Get the class name for polymorphic relations.
getMutatedAttributes()  : array<string|int, mixed>
Get the mutated attributes for a given instance.
getObservableEvents()  : array<string|int, mixed>
Get the observable event names.
getOriginal()  : mixed|array<string|int, mixed>
Get the model's original attribute values.
getPerPage()  : int
Get the number of models to return per page.
getQualifiedKeyName()  : string
Get the table qualified key name.
getQueueableConnection()  : mixed
Get the queueable connection for the entity.
getQueueableId()  : mixed
Get the queueable identity for the entity.
getRelation()  : mixed
Get a specified relationship.
getRelations()  : array<string|int, mixed>
Get all the loaded relations for the instance.
getRelationValue()  : mixed
Get a relationship.
getRouteKey()  : mixed
Get the value of the model's route key.
getRouteKeyName()  : string
Get the route key for the model.
getTable()  : string
Get the table associated with the model.
getTouchedRelations()  : array<string|int, mixed>
Get the relationships that are touched on save.
getUpdatedAtColumn()  : string
Get the name of the "updated at" column.
getVisible()  : array<string|int, mixed>
Get the visible attributes for the model.
guard()  : $this
Set the guarded attributes for the model.
hasCast()  : bool
Determine whether an attribute should be cast to a native type.
hasGetMutator()  : bool
Determine if a get mutator exists for an attribute.
hasGlobalScope()  : bool
Determine if a model has a global scope.
hasMany()  : HasMany
Define a one-to-many relationship.
hasManyThrough()  : HasManyThrough
Define a has-many-through relationship.
hasOne()  : HasOne
Define a one-to-one relationship.
hasSetMutator()  : bool
Determine if a set mutator exists for an attribute.
is()  : bool
Determine if two models have the same ID and belong to the same table.
isClean()  : bool
Determine if the model or given attribute(s) have remained the same.
isDirty()  : bool
Determine if the model or given attribute(s) have been modified.
isFillable()  : bool
Determine if the given attribute may be mass assigned.
isGuarded()  : bool
Determine if the given key is guarded.
isNot()  : bool
Determine if two models are not the same.
isUnguarded()  : bool
Determine if current state is "unguarded".
joiningTable()  : string
Get the joining table name for a many-to-many relation.
jsonSerialize()  : array<string|int, mixed>
Convert the object into something JSON serializable.
load()  : $this
Eager load relations on the model.
loadMissing()  : $this
Eager load relations on the model if they are not already eager loaded.
makeHidden()  : $this
Make the given, typically visible, attributes hidden.
makeVisible()  : $this
Make the given, typically hidden, attributes visible.
markAsRead()  : void
Mark the notification as read.
markAsUnread()  : void
Mark the notification as unread.
morphedByMany()  : MorphToMany
Define a polymorphic, inverse many-to-many relationship.
morphMany()  : MorphMany
Define a polymorphic one-to-many relationship.
morphOne()  : MorphOne
Define a polymorphic one-to-one relationship.
morphTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
morphToMany()  : MorphToMany
Define a polymorphic many-to-many relationship.
newCollection()  : DatabaseNotificationCollection
Create a new database notification collection instance.
newEloquentBuilder()  : Builder|static
Create a new Eloquent query builder for the model.
newFromBuilder()  : static
Create a new model instance that is existing.
newInstance()  : static
Create a new instance of the given model.
newModelQuery()  : Builder|static
Get a new query builder that doesn't have any global scopes or eager loading.
newPivot()  : Pivot
Create a new pivot model instance.
newQuery()  : Builder
Get a new query builder for the model's table.
newQueryForRestoration()  : Builder
Get a new query to restore one or more models by their queueable IDs.
newQueryWithoutRelationships()  : Builder
Get a new query builder with no relationships loaded.
newQueryWithoutScope()  : Builder
Get a new query instance without a given scope.
newQueryWithoutScopes()  : Builder|static
Get a new query builder that doesn't have any global scopes.
notifiable()  : mixed
Get the notifiable entity that the notification belongs to.
observe()  : void
Register an observer with the Model.
offsetExists()  : bool
Determine if the given attribute exists.
offsetGet()  : mixed
Get the value for a given offset.
offsetSet()  : void
Set the value for a given offset.
offsetUnset()  : void
Unset the value for a given offset.
on()  : Builder
Begin querying the model on a given connection.
only()  : array<string|int, mixed>
Get a subset of the model's attributes.
onWriteConnection()  : Builder
Begin querying the model on the write connection.
push()  : bool
Save the model and all of its relationships.
qualifyColumn()  : string
Qualify the given column name by the model's table.
query()  : Builder
Begin querying the model.
read()  : bool
Determine if a notification has been read.
refresh()  : $this
Reload the current model instance with fresh attributes from the database.
registerGlobalScopes()  : Builder
Register the global scopes for this builder instance.
reguard()  : void
Enable the mass assignment restrictions.
relationLoaded()  : bool
Determine if the given relation is loaded.
relationsToArray()  : array<string|int, mixed>
Get the model's relationships in array form.
removeObservableEvents()  : void
Remove an observable event name.
replicate()  : Model
Clone the model into a new, non-existing instance.
resolveConnection()  : Connection
Resolve a connection instance.
resolveRouteBinding()  : Model|null
Retrieve the model for a bound value.
retrieved()  : void
Register a retrieved model event with the dispatcher.
save()  : bool
Save the model to the database.
saved()  : void
Register a saved model event with the dispatcher.
saveOrFail()  : bool
Save the model to the database using transaction.
saving()  : void
Register a saving model event with the dispatcher.
setAppends()  : $this
Set the accessors to append to model arrays.
setAttribute()  : $this
Set a given attribute on the model.
setConnection()  : $this
Set the connection associated with the model.
setConnectionResolver()  : void
Set the connection resolver instance.
setCreatedAt()  : $this
Set the value of the "created at" attribute.
setDateFormat()  : $this
Set the date format used by the model.
setEventDispatcher()  : void
Set the event dispatcher instance.
setHidden()  : $this
Set the hidden attributes for the model.
setIncrementing()  : $this
Set whether IDs are incrementing.
setKeyName()  : $this
Set the primary key for the model.
setKeyType()  : $this
Set the data type for the primary key.
setObservableEvents()  : $this
Set the observable event names.
setPerPage()  : $this
Set the number of models to return per page.
setRawAttributes()  : $this
Set the array of model attributes. No checking is done.
setRelation()  : $this
Set the specific relationship in the model.
setRelations()  : $this
Set the entire relations array on the model.
setTable()  : $this
Set the table associated with the model.
setTouchedRelations()  : $this
Set the relationships that are touched on save.
setUpdatedAt()  : $this
Set the value of the "updated at" attribute.
setVisible()  : $this
Set the visible attributes for the model.
syncChanges()  : $this
Sync the changed attributes.
syncOriginal()  : $this
Sync the original attributes with the current.
syncOriginalAttribute()  : $this
Sync a single original attribute with its current value.
toArray()  : array<string|int, mixed>
Convert the model instance to an array.
toJson()  : string
Convert the model instance to JSON.
totallyGuarded()  : bool
Determine if the model is totally guarded.
touch()  : bool
Update the model's update timestamp.
touches()  : bool
Determine if the model touches a given relation.
touchOwners()  : void
Touch the owning relations of the model.
unguard()  : void
Disable all mass assignable restrictions.
unguarded()  : mixed
Run the given callable while being unguarded.
unread()  : bool
Determine if a notification has not been read.
unsetConnectionResolver()  : void
Unset the connection resolver for models.
unsetEventDispatcher()  : void
Unset the event dispatcher for models.
update()  : bool
Update the model in the database.
updated()  : void
Register an updated model event with the dispatcher.
updating()  : void
Register an updating model event with the dispatcher.
usesTimestamps()  : bool
Determine if the model uses timestamps.
wasChanged()  : bool
Determine if the model or given attribute(s) have been modified.
with()  : Builder|static
Begin querying a model with eager loading.
addCastAttributesToArray()  : array<string|int, mixed>
Add the casted attributes to the attributes array.
addDateAttributesToArray()  : array<string|int, mixed>
Add the date attributes to the attributes array.
addMutatedAttributesToArray()  : array<string|int, mixed>
Add the mutated attributes to the attributes array.
asDate()  : Carbon
Return a timestamp as DateTime object with time set to 00:00:00.
asDateTime()  : Carbon
Return a timestamp as DateTime object.
asJson()  : string
Encode the given value as JSON.
asTimestamp()  : int
Return a timestamp as unix timestamp.
boot()  : void
The "booting" method of the model.
bootIfNotBooted()  : void
Check if the model needs to be booted and if so, do it.
bootTraits()  : void
Boot all of the bootable traits on the model.
castAttribute()  : mixed
Cast an attribute to a native PHP type.
castAttributeAsJson()  : string
Cast the given attribute to JSON.
decrement()  : int
Decrement a column's value by a given amount.
fillableFromArray()  : array<string|int, mixed>
Get the fillable attributes of a given array.
filterModelEventResults()  : mixed
Filter the model event results.
finishSave()  : void
Perform any actions that are necessary after the model is saved.
fireCustomModelEvent()  : mixed|null
Fire a custom model event for the given event.
fireModelEvent()  : mixed
Fire the given event for the model.
getArrayableAppends()  : array<string|int, mixed>
Get all of the appendable values that are arrayable.
getArrayableAttributes()  : array<string|int, mixed>
Get an attribute array of all arrayable attributes.
getArrayableItems()  : array<string|int, mixed>
Get an attribute array of all arrayable values.
getArrayableRelations()  : array<string|int, mixed>
Get an attribute array of all arrayable relations.
getArrayAttributeByKey()  : array<string|int, mixed>
Get an array attribute or return an empty array if it is not set.
getArrayAttributeWithValue()  : $this
Get an array attribute with the given key and value set.
getAttributeFromArray()  : mixed
Get an attribute from the $attributes array.
getCastType()  : string
Get the type of cast for a model attribute.
getDateFormat()  : string
Get the format for database stored dates.
getKeyForSaveQuery()  : mixed
Get the primary key value for a save query.
getMorphs()  : array<string|int, mixed>
Get the polymorphic relationship columns.
getMutatorMethods()  : array<string|int, mixed>
Get all of the attribute mutator methods.
getRelationshipFromMethod()  : mixed
Get a relationship value from a method.
guessBelongsToManyRelation()  : string
Get the relationship name of the belongs to many.
guessBelongsToRelation()  : string
Guess the "belongs to" relationship name.
hasChanges()  : bool
Determine if the given attributes were changed.
increment()  : int
Increment a column's value by a given amount.
incrementOrDecrement()  : int
Run the increment or decrement method on the model.
incrementOrDecrementAttributeValue()  : void
Increment the underlying attribute value and sync with original.
insertAndSetId()  : void
Insert the given attributes and set the ID on the model.
isDateAttribute()  : bool
Determine if the given attribute is a date or date castable.
isDateCastable()  : bool
Determine whether a value is Date / DateTime castable for inbound manipulation.
isGuardableColumn()  : bool
Determine if the given column is a valid, guardable column.
isJsonCastable()  : bool
Determine whether a value is JSON castable for inbound manipulation.
isStandardDateFormat()  : bool
Determine if the given value is a standard date format.
morphEagerTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
morphInstanceTo()  : MorphTo
Define a polymorphic, inverse one-to-one or many relationship.
mutateAttribute()  : mixed
Get the value of an attribute using its mutator.
mutateAttributeForArray()  : mixed
Get the value of an attribute using its mutator for array conversion.
newBaseQueryBuilder()  : Builder
Get a new query builder instance for the connection.
newBelongsTo()  : BelongsTo
Instantiate a new BelongsTo relationship.
newBelongsToMany()  : BelongsToMany
Instantiate a new BelongsToMany relationship.
newHasMany()  : HasMany
Instantiate a new HasMany relationship.
newHasManyThrough()  : HasManyThrough
Instantiate a new HasManyThrough relationship.
newHasOne()  : HasOne
Instantiate a new HasOne relationship.
newMorphMany()  : MorphMany
Instantiate a new MorphMany relationship.
newMorphOne()  : MorphOne
Instantiate a new MorphOne relationship.
newMorphTo()  : MorphTo
Instantiate a new MorphTo relationship.
newMorphToMany()  : MorphToMany
Instantiate a new HasManyThrough relationship.
newRelatedInstance()  : mixed
Create a new model instance for a related model.
originalIsEquivalent()  : bool
Determine if the new and old values for a given key are equivalent.
performDeleteOnModel()  : void
Perform the actual delete query on this model instance.
performInsert()  : bool
Perform a model insert operation.
performUpdate()  : bool
Perform a model update operation.
registerModelEvent()  : void
Register a model event with the dispatcher.
removeTableFromKey()  : string
Remove the table name from a given key.
serializeDate()  : string
Prepare a date for array / JSON serialization.
setKeysForSaveQuery()  : Builder
Set the keys for a save update query.
updateTimestamps()  : void
Update the creation and update timestamps.

Constants

CREATED_AT

The name of the "created at" column.

public string CREATED_AT = 'created_at'

UPDATED_AT

The name of the "updated at" column.

public string UPDATED_AT = 'updated_at'

Properties

$exists

Indicates if the model exists.

public bool $exists = false

$incrementing

Indicates if the IDs are auto-incrementing.

public bool $incrementing = false

$manyMethods

The many to many relationship methods.

public static array<string|int, mixed> $manyMethods = ['belongsToMany', 'morphToMany', 'morphedByMany', 'guessBelongsToManyRelation', 'findFirstMethodThatIsntRelation']

$snakeAttributes

Indicates whether attributes are snake cased on arrays.

public static bool $snakeAttributes = true

$timestamps

Indicates if the model should be timestamped.

public bool $timestamps = true

$wasRecentlyCreated

Indicates if the model was inserted during the current request lifecycle.

public bool $wasRecentlyCreated = false

$appends

The accessors to append to the model's array form.

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

$attributes

The model's attributes.

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

$booted

The array of booted models.

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

$casts

The attributes that should be cast to native types.

protected array<string|int, mixed> $casts = ['data' => 'array', 'read_at' => 'datetime']

$changes

The changed model attributes.

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

$connection

The connection name for the model.

protected string $connection

$dateFormat

The storage format of the model's date columns.

protected string $dateFormat

$dates

The attributes that should be mutated to dates.

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

$dispatcher

The event dispatcher instance.

protected static Dispatcher $dispatcher

$dispatchesEvents

The event map for the model.

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

Allows for object-based events for native Eloquent events.

$fillable

The attributes that are mass assignable.

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

$globalScopes

The array of global scopes on the model.

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

$guardableColumns

The actual columns that exist on the database and can be guarded.

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

$guarded

The guarded attributes on the model.

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

$hidden

The attributes that should be hidden for serialization.

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

$keyType

The "type" of the auto-incrementing ID.

protected string $keyType = 'int'

$mutatorCache

The cache of the mutated attributes for each class.

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

$observables

User exposed observable events.

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

These are extra user-defined events observers may subscribe to.

$original

The model attribute's original state.

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

$perPage

The number of models to return for pagination.

protected int $perPage = 15

$primaryKey

The primary key for the model.

protected string $primaryKey = 'id'

$relations

The loaded relationships for the model.

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

$touches

The relationships that should be touched on save.

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

$unguarded

Indicates if all mass assignment is enabled.

protected static bool $unguarded = false

$visible

The attributes that should be visible in serialization.

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

$with

The relations to eager load on every query.

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

$withCount

The relationship counts that should be eager loaded on every query.

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

Methods

__call()

Handle dynamic method calls into the model.

public __call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed

__callStatic()

Handle dynamic static method calls into the method.

public static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
$method : string
$parameters : array<string|int, mixed>
Return values
mixed

__construct()

Create a new Eloquent model instance.

public __construct([array<string|int, mixed> $attributes = [] ]) : void
Parameters
$attributes : array<string|int, mixed> = []
Return values
void

__get()

Dynamically retrieve attributes on the model.

public __get(string $key) : mixed
Parameters
$key : string
Return values
mixed

__isset()

Determine if an attribute or relation exists on the model.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

__set()

Dynamically set attributes on the model.

public __set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed
Return values
void

__toString()

Convert the model to its string representation.

public __toString() : string
Return values
string

__unset()

Unset an attribute on the model.

public __unset(string $key) : void
Parameters
$key : string
Return values
void

__wakeup()

When a model is being unserialized, check if it needs to be booted.

public __wakeup() : void
Return values
void

addGlobalScope()

Register a new global scope on the model.

public static addGlobalScope(Scope|Closure|string $scope[, Closure|null $implementation = null ]) : mixed
Parameters
$scope : Scope|Closure|string
$implementation : Closure|null = null
Tags
throws
InvalidArgumentException
Return values
mixed

addHidden()

Add hidden attributes for the model.

public addHidden([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void

addObservableEvents()

Add an observable event name.

public addObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
$observables : array<string|int, mixed>|mixed
Return values
void

addVisible()

Add visible attributes for the model.

public addVisible([array<string|int, mixed>|string|null $attributes = null ]) : void
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
void

all()

Get all of the models from the database.

public static all([array<string|int, mixed>|mixed $columns = ['*'] ]) : Collection|array<string|int, static>
Parameters
$columns : array<string|int, mixed>|mixed = ['*']
Return values
Collection|array<string|int, static>

append()

Append attributes to query when building a query.

public append(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this

attributesToArray()

Convert the model's attributes to an array.

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

belongsTo()

Define an inverse one-to-one or many relationship.

public belongsTo(string $related[, string $foreignKey = null ][, string $ownerKey = null ][, string $relation = null ]) : BelongsTo
Parameters
$related : string
$foreignKey : string = null
$ownerKey : string = null
$relation : string = null
Return values
BelongsTo

belongsToMany()

Define a many-to-many relationship.

public belongsToMany(string $related[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ][, string $relation = null ]) : BelongsToMany
Parameters
$related : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
$relation : string = null
Return values
BelongsToMany

cacheMutatedAttributes()

Extract and cache all the mutated attributes of a class.

public static cacheMutatedAttributes(string $class) : void
Parameters
$class : string
Return values
void

clearBootedModels()

Clear the list of booted models so they will be re-booted.

public static clearBootedModels() : void
Return values
void

created()

Register a created model event with the dispatcher.

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

creating()

Register a creating model event with the dispatcher.

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

delete()

Delete the model from the database.

public delete() : bool|null
Tags
throws
Exception
Return values
bool|null

deleted()

Register a deleted model event with the dispatcher.

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

deleting()

Register a deleting model event with the dispatcher.

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

destroy()

Destroy the models for the given IDs.

public static destroy(array<string|int, mixed>|int $ids) : int
Parameters
$ids : array<string|int, mixed>|int
Return values
int

fill()

Fill the model with an array of attributes.

public fill(array<string|int, mixed> $attributes) : $this
Parameters
$attributes : array<string|int, mixed>
Tags
throws
MassAssignmentException
Return values
$this

fillable()

Set the fillable attributes for the model.

public fillable(array<string|int, mixed> $fillable) : $this
Parameters
$fillable : array<string|int, mixed>
Return values
$this

fillJsonAttribute()

Set a given JSON attribute on the model.

public fillJsonAttribute(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

flushEventListeners()

Remove all of the event listeners for the model.

public static flushEventListeners() : void
Return values
void

forceDelete()

Force a hard delete on a soft deleted model.

public forceDelete() : bool|null

This method protects developers from running forceDelete when trait is missing.

Return values
bool|null

forceFill()

Fill the model with an array of attributes. Force mass assignment.

public forceFill(array<string|int, mixed> $attributes) : $this
Parameters
$attributes : array<string|int, mixed>
Return values
$this

fresh()

Reload a fresh model instance from the database.

public fresh([array<string|int, mixed>|string $with = [] ]) : static|null
Parameters
$with : array<string|int, mixed>|string = []
Return values
static|null

freshTimestampString()

Get a fresh timestamp for the model.

public freshTimestampString() : string
Return values
string

fromDateTime()

Convert a DateTime to a storable string.

public fromDateTime(DateTime|int $value) : string
Parameters
$value : DateTime|int
Return values
string

fromJson()

Decode the given JSON back into an array or object.

public fromJson(string $value[, bool $asObject = false ]) : mixed
Parameters
$value : string
$asObject : bool = false
Return values
mixed

getActualClassNameForMorph()

Retrieve the actual class name for a given morph class.

public static getActualClassNameForMorph(string $class) : string
Parameters
$class : string
Return values
string

getAttribute()

Get an attribute from the model.

public getAttribute(string $key) : mixed
Parameters
$key : string
Return values
mixed

getAttributes()

Get all of the current attributes on the model.

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

getAttributeValue()

Get a plain attribute (not a relationship).

public getAttributeValue(string $key) : mixed
Parameters
$key : string
Return values
mixed

getCasts()

Get the casts array.

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

getChanges()

Get the attributes that were changed.

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

getConnectionName()

Get the current connection name for the model.

public getConnectionName() : string
Return values
string

getCreatedAtColumn()

Get the name of the "created at" column.

public getCreatedAtColumn() : string
Return values
string

getDates()

Get the attributes that should be converted to dates.

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

getDirty()

Get the attributes that have been changed since last sync.

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

getFillable()

Get the fillable attributes for the model.

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

getForeignKey()

Get the default foreign key name for the model.

public getForeignKey() : string
Return values
string

getGlobalScope()

Get a global scope registered with the model.

public static getGlobalScope(Scope|string $scope) : Scope|Closure|null
Parameters
$scope : Scope|string
Return values
Scope|Closure|null

getGlobalScopes()

Get the global scopes for this class instance.

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

getGuarded()

Get the guarded attributes for the model.

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

getHidden()

Get the hidden attributes for the model.

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

getIncrementing()

Get the value indicating whether the IDs are incrementing.

public getIncrementing() : bool
Return values
bool

getKey()

Get the value of the model's primary key.

public getKey() : mixed
Return values
mixed

getKeyName()

Get the primary key for the model.

public getKeyName() : string
Return values
string

getKeyType()

Get the auto-incrementing key type.

public getKeyType() : string
Return values
string

getMorphClass()

Get the class name for polymorphic relations.

public getMorphClass() : string
Return values
string

getMutatedAttributes()

Get the mutated attributes for a given instance.

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

getObservableEvents()

Get the observable event names.

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

getOriginal()

Get the model's original attribute values.

public getOriginal([string|null $key = null ][, mixed $default = null ]) : mixed|array<string|int, mixed>
Parameters
$key : string|null = null
$default : mixed = null
Return values
mixed|array<string|int, mixed>

getPerPage()

Get the number of models to return per page.

public getPerPage() : int
Return values
int

getQualifiedKeyName()

Get the table qualified key name.

public getQualifiedKeyName() : string
Return values
string

getQueueableConnection()

Get the queueable connection for the entity.

public getQueueableConnection() : mixed
Return values
mixed

getQueueableId()

Get the queueable identity for the entity.

public getQueueableId() : mixed
Return values
mixed

getRelation()

Get a specified relationship.

public getRelation(string $relation) : mixed
Parameters
$relation : string
Return values
mixed

getRelations()

Get all the loaded relations for the instance.

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

getRelationValue()

Get a relationship.

public getRelationValue(string $key) : mixed
Parameters
$key : string
Return values
mixed

getRouteKey()

Get the value of the model's route key.

public getRouteKey() : mixed
Return values
mixed

getRouteKeyName()

Get the route key for the model.

public getRouteKeyName() : string
Return values
string

getTable()

Get the table associated with the model.

public getTable() : string
Return values
string

getTouchedRelations()

Get the relationships that are touched on save.

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

getUpdatedAtColumn()

Get the name of the "updated at" column.

public getUpdatedAtColumn() : string
Return values
string

getVisible()

Get the visible attributes for the model.

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

guard()

Set the guarded attributes for the model.

public guard(array<string|int, mixed> $guarded) : $this
Parameters
$guarded : array<string|int, mixed>
Return values
$this

hasCast()

Determine whether an attribute should be cast to a native type.

public hasCast(string $key[, array<string|int, mixed>|string|null $types = null ]) : bool
Parameters
$key : string
$types : array<string|int, mixed>|string|null = null
Return values
bool

hasGetMutator()

Determine if a get mutator exists for an attribute.

public hasGetMutator(string $key) : bool
Parameters
$key : string
Return values
bool

hasGlobalScope()

Determine if a model has a global scope.

public static hasGlobalScope(Scope|string $scope) : bool
Parameters
$scope : Scope|string
Return values
bool

hasMany()

Define a one-to-many relationship.

public hasMany(string $related[, string $foreignKey = null ][, string $localKey = null ]) : HasMany
Parameters
$related : string
$foreignKey : string = null
$localKey : string = null
Return values
HasMany

hasManyThrough()

Define a has-many-through relationship.

public hasManyThrough(string $related, string $through[, string|null $firstKey = null ][, string|null $secondKey = null ][, string|null $localKey = null ][, string|null $secondLocalKey = null ]) : HasManyThrough
Parameters
$related : string
$through : string
$firstKey : string|null = null
$secondKey : string|null = null
$localKey : string|null = null
$secondLocalKey : string|null = null
Return values
HasManyThrough

hasOne()

Define a one-to-one relationship.

public hasOne(string $related[, string $foreignKey = null ][, string $localKey = null ]) : HasOne
Parameters
$related : string
$foreignKey : string = null
$localKey : string = null
Return values
HasOne

hasSetMutator()

Determine if a set mutator exists for an attribute.

public hasSetMutator(string $key) : bool
Parameters
$key : string
Return values
bool

is()

Determine if two models have the same ID and belong to the same table.

public is(Model|null $model) : bool
Parameters
$model : Model|null
Return values
bool

isClean()

Determine if the model or given attribute(s) have remained the same.

public isClean([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool

isDirty()

Determine if the model or given attribute(s) have been modified.

public isDirty([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool

isFillable()

Determine if the given attribute may be mass assigned.

public isFillable(string $key) : bool
Parameters
$key : string
Return values
bool

isGuarded()

Determine if the given key is guarded.

public isGuarded(string $key) : bool
Parameters
$key : string
Return values
bool

isNot()

Determine if two models are not the same.

public isNot(Model|null $model) : bool
Parameters
$model : Model|null
Return values
bool

isUnguarded()

Determine if current state is "unguarded".

public static isUnguarded() : bool
Return values
bool

joiningTable()

Get the joining table name for a many-to-many relation.

public joiningTable(string $related) : string
Parameters
$related : string
Return values
string

jsonSerialize()

Convert the object into something JSON serializable.

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

load()

Eager load relations on the model.

public load(array<string|int, mixed>|string $relations) : $this
Parameters
$relations : array<string|int, mixed>|string
Return values
$this

loadMissing()

Eager load relations on the model if they are not already eager loaded.

public loadMissing(array<string|int, mixed>|string $relations) : $this
Parameters
$relations : array<string|int, mixed>|string
Return values
$this

makeHidden()

Make the given, typically visible, attributes hidden.

public makeHidden(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this

makeVisible()

Make the given, typically hidden, attributes visible.

public makeVisible(array<string|int, mixed>|string $attributes) : $this
Parameters
$attributes : array<string|int, mixed>|string
Return values
$this

markAsRead()

Mark the notification as read.

public markAsRead() : void
Return values
void

markAsUnread()

Mark the notification as unread.

public markAsUnread() : void
Return values
void

morphedByMany()

Define a polymorphic, inverse many-to-many relationship.

public morphedByMany(string $related, string $name[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ]) : MorphToMany
Parameters
$related : string
$name : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
Return values
MorphToMany

morphMany()

Define a polymorphic one-to-many relationship.

public morphMany(string $related, string $name[, string $type = null ][, string $id = null ][, string $localKey = null ]) : MorphMany
Parameters
$related : string
$name : string
$type : string = null
$id : string = null
$localKey : string = null
Return values
MorphMany

morphOne()

Define a polymorphic one-to-one relationship.

public morphOne(string $related, string $name[, string $type = null ][, string $id = null ][, string $localKey = null ]) : MorphOne
Parameters
$related : string
$name : string
$type : string = null
$id : string = null
$localKey : string = null
Return values
MorphOne

morphTo()

Define a polymorphic, inverse one-to-one or many relationship.

public morphTo([string $name = null ][, string $type = null ][, string $id = null ]) : MorphTo
Parameters
$name : string = null
$type : string = null
$id : string = null
Return values
MorphTo

morphToMany()

Define a polymorphic many-to-many relationship.

public morphToMany(string $related, string $name[, string $table = null ][, string $foreignPivotKey = null ][, string $relatedPivotKey = null ][, string $parentKey = null ][, string $relatedKey = null ][, bool $inverse = false ]) : MorphToMany
Parameters
$related : string
$name : string
$table : string = null
$foreignPivotKey : string = null
$relatedPivotKey : string = null
$parentKey : string = null
$relatedKey : string = null
$inverse : bool = false
Return values
MorphToMany

newEloquentBuilder()

Create a new Eloquent query builder for the model.

public newEloquentBuilder(Builder $query) : Builder|static
Parameters
$query : Builder
Return values
Builder|static

newFromBuilder()

Create a new model instance that is existing.

public newFromBuilder([array<string|int, mixed> $attributes = [] ][, string|null $connection = null ]) : static
Parameters
$attributes : array<string|int, mixed> = []
$connection : string|null = null
Return values
static

newInstance()

Create a new instance of the given model.

public newInstance([array<string|int, mixed> $attributes = [] ][, bool $exists = false ]) : static
Parameters
$attributes : array<string|int, mixed> = []
$exists : bool = false
Return values
static

newModelQuery()

Get a new query builder that doesn't have any global scopes or eager loading.

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

newPivot()

Create a new pivot model instance.

public newPivot(Model $parent, array<string|int, mixed> $attributes, string $table, bool $exists[, string|null $using = null ]) : Pivot
Parameters
$parent : Model
$attributes : array<string|int, mixed>
$table : string
$exists : bool
$using : string|null = null
Return values
Pivot

newQuery()

Get a new query builder for the model's table.

public newQuery() : Builder
Return values
Builder

newQueryForRestoration()

Get a new query to restore one or more models by their queueable IDs.

public newQueryForRestoration(array<string|int, mixed>|int $ids) : Builder
Parameters
$ids : array<string|int, mixed>|int
Return values
Builder

newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

public newQueryWithoutRelationships() : Builder
Return values
Builder

newQueryWithoutScope()

Get a new query instance without a given scope.

public newQueryWithoutScope(Scope|string $scope) : Builder
Parameters
$scope : Scope|string
Return values
Builder

newQueryWithoutScopes()

Get a new query builder that doesn't have any global scopes.

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

notifiable()

Get the notifiable entity that the notification belongs to.

public notifiable() : mixed
Return values
mixed

observe()

Register an observer with the Model.

public static observe(object|string $class) : void
Parameters
$class : object|string
Return values
void

offsetExists()

Determine if the given attribute exists.

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

Get the value for a given offset.

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Return values
mixed

offsetSet()

Set the value for a given offset.

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed
Return values
void

offsetUnset()

Unset the value for a given offset.

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Return values
void

on()

Begin querying the model on a given connection.

public static on([string|null $connection = null ]) : Builder
Parameters
$connection : string|null = null
Return values
Builder

only()

Get a subset of the model's attributes.

public only(array<string|int, mixed>|mixed $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>|mixed
Return values
array<string|int, mixed>

onWriteConnection()

Begin querying the model on the write connection.

public static onWriteConnection() : Builder
Return values
Builder

push()

Save the model and all of its relationships.

public push() : bool
Return values
bool

qualifyColumn()

Qualify the given column name by the model's table.

public qualifyColumn(string $column) : string
Parameters
$column : string
Return values
string

read()

Determine if a notification has been read.

public read() : bool
Return values
bool

refresh()

Reload the current model instance with fresh attributes from the database.

public refresh() : $this
Return values
$this

registerGlobalScopes()

Register the global scopes for this builder instance.

public registerGlobalScopes(Builder $builder) : Builder
Parameters
$builder : Builder
Return values
Builder

reguard()

Enable the mass assignment restrictions.

public static reguard() : void
Return values
void

relationLoaded()

Determine if the given relation is loaded.

public relationLoaded(string $key) : bool
Parameters
$key : string
Return values
bool

relationsToArray()

Get the model's relationships in array form.

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

removeObservableEvents()

Remove an observable event name.

public removeObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
$observables : array<string|int, mixed>|mixed
Return values
void

replicate()

Clone the model into a new, non-existing instance.

public replicate([array<string|int, mixed>|null $except = null ]) : Model
Parameters
$except : array<string|int, mixed>|null = null
Return values
Model

resolveConnection()

Resolve a connection instance.

public static resolveConnection([string|null $connection = null ]) : Connection
Parameters
$connection : string|null = null
Return values
Connection

resolveRouteBinding()

Retrieve the model for a bound value.

public resolveRouteBinding(mixed $value) : Model|null
Parameters
$value : mixed
Return values
Model|null

retrieved()

Register a retrieved model event with the dispatcher.

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

save()

Save the model to the database.

public save([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Return values
bool

saved()

Register a saved model event with the dispatcher.

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

saveOrFail()

Save the model to the database using transaction.

public saveOrFail([array<string|int, mixed> $options = [] ]) : bool
Parameters
$options : array<string|int, mixed> = []
Tags
throws
Throwable
Return values
bool

saving()

Register a saving model event with the dispatcher.

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

setAppends()

Set the accessors to append to model arrays.

public setAppends(array<string|int, mixed> $appends) : $this
Parameters
$appends : array<string|int, mixed>
Return values
$this

setAttribute()

Set a given attribute on the model.

public setAttribute(string $key, mixed $value) : $this
Parameters
$key : string
$value : mixed
Return values
$this

setConnection()

Set the connection associated with the model.

public setConnection(string $name) : $this
Parameters
$name : string
Return values
$this

setCreatedAt()

Set the value of the "created at" attribute.

public setCreatedAt(mixed $value) : $this
Parameters
$value : mixed
Return values
$this

setDateFormat()

Set the date format used by the model.

public setDateFormat(string $format) : $this
Parameters
$format : string
Return values
$this

setEventDispatcher()

Set the event dispatcher instance.

public static setEventDispatcher(Dispatcher $dispatcher) : void
Parameters
$dispatcher : Dispatcher
Return values
void

setHidden()

Set the hidden attributes for the model.

public setHidden(array<string|int, mixed> $hidden) : $this
Parameters
$hidden : array<string|int, mixed>
Return values
$this

setIncrementing()

Set whether IDs are incrementing.

public setIncrementing(bool $value) : $this
Parameters
$value : bool
Return values
$this

setKeyName()

Set the primary key for the model.

public setKeyName(string $key) : $this
Parameters
$key : string
Return values
$this

setKeyType()

Set the data type for the primary key.

public setKeyType(string $type) : $this
Parameters
$type : string
Return values
$this

setObservableEvents()

Set the observable event names.

public setObservableEvents(array<string|int, mixed> $observables) : $this
Parameters
$observables : array<string|int, mixed>
Return values
$this

setPerPage()

Set the number of models to return per page.

public setPerPage(int $perPage) : $this
Parameters
$perPage : int
Return values
$this

setRawAttributes()

Set the array of model attributes. No checking is done.

public setRawAttributes(array<string|int, mixed> $attributes[, bool $sync = false ]) : $this
Parameters
$attributes : array<string|int, mixed>
$sync : bool = false
Return values
$this

setRelation()

Set the specific relationship in the model.

public setRelation(string $relation, mixed $value) : $this
Parameters
$relation : string
$value : mixed
Return values
$this

setRelations()

Set the entire relations array on the model.

public setRelations(array<string|int, mixed> $relations) : $this
Parameters
$relations : array<string|int, mixed>
Return values
$this

setTable()

Set the table associated with the model.

public setTable(string $table) : $this
Parameters
$table : string
Return values
$this

setTouchedRelations()

Set the relationships that are touched on save.

public setTouchedRelations(array<string|int, mixed> $touches) : $this
Parameters
$touches : array<string|int, mixed>
Return values
$this

setUpdatedAt()

Set the value of the "updated at" attribute.

public setUpdatedAt(mixed $value) : $this
Parameters
$value : mixed
Return values
$this

setVisible()

Set the visible attributes for the model.

public setVisible(array<string|int, mixed> $visible) : $this
Parameters
$visible : array<string|int, mixed>
Return values
$this

syncChanges()

Sync the changed attributes.

public syncChanges() : $this
Return values
$this

syncOriginal()

Sync the original attributes with the current.

public syncOriginal() : $this
Return values
$this

syncOriginalAttribute()

Sync a single original attribute with its current value.

public syncOriginalAttribute(string $attribute) : $this
Parameters
$attribute : string
Return values
$this

toArray()

Convert the model instance to an array.

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

toJson()

Convert the model instance to JSON.

public toJson(int $options) : string
Parameters
$options : int
Tags
throws
JsonEncodingException
Return values
string

totallyGuarded()

Determine if the model is totally guarded.

public totallyGuarded() : bool
Return values
bool

touch()

Update the model's update timestamp.

public touch() : bool
Return values
bool

touches()

Determine if the model touches a given relation.

public touches(string $relation) : bool
Parameters
$relation : string
Return values
bool

touchOwners()

Touch the owning relations of the model.

public touchOwners() : void
Return values
void

unguard()

Disable all mass assignable restrictions.

public static unguard([bool $state = true ]) : void
Parameters
$state : bool = true
Return values
void

unguarded()

Run the given callable while being unguarded.

public static unguarded(callable $callback) : mixed
Parameters
$callback : callable
Return values
mixed

unread()

Determine if a notification has not been read.

public unread() : bool
Return values
bool

unsetConnectionResolver()

Unset the connection resolver for models.

public static unsetConnectionResolver() : void
Return values
void

unsetEventDispatcher()

Unset the event dispatcher for models.

public static unsetEventDispatcher() : void
Return values
void

update()

Update the model in the database.

public update([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
$attributes : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Return values
bool

updated()

Register an updated model event with the dispatcher.

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

updating()

Register an updating model event with the dispatcher.

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

usesTimestamps()

Determine if the model uses timestamps.

public usesTimestamps() : bool
Return values
bool

wasChanged()

Determine if the model or given attribute(s) have been modified.

public wasChanged([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$attributes : array<string|int, mixed>|string|null = null
Return values
bool

with()

Begin querying a model with eager loading.

public static with(array<string|int, mixed>|string $relations) : Builder|static
Parameters
$relations : array<string|int, mixed>|string
Return values
Builder|static

addCastAttributesToArray()

Add the casted attributes to the attributes array.

protected addCastAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
$mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>

addDateAttributesToArray()

Add the date attributes to the attributes array.

protected addDateAttributesToArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

addMutatedAttributesToArray()

Add the mutated attributes to the attributes array.

protected addMutatedAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
$mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>

asDate()

Return a timestamp as DateTime object with time set to 00:00:00.

protected asDate(mixed $value) : Carbon
Parameters
$value : mixed
Return values
Carbon

asDateTime()

Return a timestamp as DateTime object.

protected asDateTime(mixed $value) : Carbon
Parameters
$value : mixed
Return values
Carbon

asJson()

Encode the given value as JSON.

protected asJson(mixed $value) : string
Parameters
$value : mixed
Return values
string

asTimestamp()

Return a timestamp as unix timestamp.

protected asTimestamp(mixed $value) : int
Parameters
$value : mixed
Return values
int

boot()

The "booting" method of the model.

protected static boot() : void
Return values
void

bootIfNotBooted()

Check if the model needs to be booted and if so, do it.

protected bootIfNotBooted() : void
Return values
void

bootTraits()

Boot all of the bootable traits on the model.

protected static bootTraits() : void
Return values
void

castAttribute()

Cast an attribute to a native PHP type.

protected castAttribute(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed

castAttributeAsJson()

Cast the given attribute to JSON.

protected castAttributeAsJson(string $key, mixed $value) : string
Parameters
$key : string
$value : mixed
Return values
string

decrement()

Decrement a column's value by a given amount.

protected decrement(string $column[, int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
$column : string
$amount : int = 1
$extra : array<string|int, mixed> = []
Return values
int

fillableFromArray()

Get the fillable attributes of a given array.

protected fillableFromArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
$attributes : array<string|int, mixed>
Return values
array<string|int, mixed>

filterModelEventResults()

Filter the model event results.

protected filterModelEventResults(mixed $result) : mixed
Parameters
$result : mixed
Return values
mixed

finishSave()

Perform any actions that are necessary after the model is saved.

protected finishSave(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>
Return values
void

fireCustomModelEvent()

Fire a custom model event for the given event.

protected fireCustomModelEvent(string $event, string $method) : mixed|null
Parameters
$event : string
$method : string
Return values
mixed|null

fireModelEvent()

Fire the given event for the model.

protected fireModelEvent(string $event[, bool $halt = true ]) : mixed
Parameters
$event : string
$halt : bool = true
Return values
mixed

getArrayableAppends()

Get all of the appendable values that are arrayable.

protected getArrayableAppends() : array<string|int, mixed>
Return values
array<string|int, mixed>

getArrayableAttributes()

Get an attribute array of all arrayable attributes.

protected getArrayableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getArrayableItems()

Get an attribute array of all arrayable values.

protected getArrayableItems(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

getArrayableRelations()

Get an attribute array of all arrayable relations.

protected getArrayableRelations() : array<string|int, mixed>
Return values
array<string|int, mixed>

getArrayAttributeByKey()

Get an array attribute or return an empty array if it is not set.

protected getArrayAttributeByKey(string $key) : array<string|int, mixed>
Parameters
$key : string
Return values
array<string|int, mixed>

getArrayAttributeWithValue()

Get an array attribute with the given key and value set.

protected getArrayAttributeWithValue(string $path, string $key, mixed $value) : $this
Parameters
$path : string
$key : string
$value : mixed
Return values
$this

getAttributeFromArray()

Get an attribute from the $attributes array.

protected getAttributeFromArray(string $key) : mixed
Parameters
$key : string
Return values
mixed

getCastType()

Get the type of cast for a model attribute.

protected getCastType(string $key) : string
Parameters
$key : string
Return values
string

getDateFormat()

Get the format for database stored dates.

protected getDateFormat() : string
Return values
string

getKeyForSaveQuery()

Get the primary key value for a save query.

protected getKeyForSaveQuery() : mixed
Return values
mixed

getMorphs()

Get the polymorphic relationship columns.

protected getMorphs(string $name, string $type, string $id) : array<string|int, mixed>
Parameters
$name : string
$type : string
$id : string
Return values
array<string|int, mixed>

getMutatorMethods()

Get all of the attribute mutator methods.

protected static getMutatorMethods(mixed $class) : array<string|int, mixed>
Parameters
$class : mixed
Return values
array<string|int, mixed>

getRelationshipFromMethod()

Get a relationship value from a method.

protected getRelationshipFromMethod(string $method) : mixed
Parameters
$method : string
Tags
throws
LogicException
Return values
mixed

guessBelongsToManyRelation()

Get the relationship name of the belongs to many.

protected guessBelongsToManyRelation() : string
Return values
string

guessBelongsToRelation()

Guess the "belongs to" relationship name.

protected guessBelongsToRelation() : string
Return values
string

hasChanges()

Determine if the given attributes were changed.

protected hasChanges(array<string|int, mixed> $changes[, array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
$changes : array<string|int, mixed>
$attributes : array<string|int, mixed>|string|null = null
Return values
bool

increment()

Increment a column's value by a given amount.

protected increment(string $column[, int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
$column : string
$amount : int = 1
$extra : array<string|int, mixed> = []
Return values
int

incrementOrDecrement()

Run the increment or decrement method on the model.

protected incrementOrDecrement(string $column, int $amount, array<string|int, mixed> $extra, string $method) : int
Parameters
$column : string
$amount : int
$extra : array<string|int, mixed>
$method : string
Return values
int

incrementOrDecrementAttributeValue()

Increment the underlying attribute value and sync with original.

protected incrementOrDecrementAttributeValue(string $column, int $amount, array<string|int, mixed> $extra, string $method) : void
Parameters
$column : string
$amount : int
$extra : array<string|int, mixed>
$method : string
Return values
void

insertAndSetId()

Insert the given attributes and set the ID on the model.

protected insertAndSetId(Builder $query, array<string|int, mixed> $attributes) : void
Parameters
$query : Builder
$attributes : array<string|int, mixed>
Return values
void

isDateAttribute()

Determine if the given attribute is a date or date castable.

protected isDateAttribute(string $key) : bool
Parameters
$key : string
Return values
bool

isDateCastable()

Determine whether a value is Date / DateTime castable for inbound manipulation.

protected isDateCastable(string $key) : bool
Parameters
$key : string
Return values
bool

isGuardableColumn()

Determine if the given column is a valid, guardable column.

protected isGuardableColumn(string $key) : bool
Parameters
$key : string
Return values
bool

isJsonCastable()

Determine whether a value is JSON castable for inbound manipulation.

protected isJsonCastable(string $key) : bool
Parameters
$key : string
Return values
bool

isStandardDateFormat()

Determine if the given value is a standard date format.

protected isStandardDateFormat(string $value) : bool
Parameters
$value : string
Return values
bool

morphEagerTo()

Define a polymorphic, inverse one-to-one or many relationship.

protected morphEagerTo(string $name, string $type, string $id) : MorphTo
Parameters
$name : string
$type : string
$id : string
Return values
MorphTo

morphInstanceTo()

Define a polymorphic, inverse one-to-one or many relationship.

protected morphInstanceTo(string $target, string $name, string $type, string $id) : MorphTo
Parameters
$target : string
$name : string
$type : string
$id : string
Return values
MorphTo

mutateAttribute()

Get the value of an attribute using its mutator.

protected mutateAttribute(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed

mutateAttributeForArray()

Get the value of an attribute using its mutator for array conversion.

protected mutateAttributeForArray(string $key, mixed $value) : mixed
Parameters
$key : string
$value : mixed
Return values
mixed

newBaseQueryBuilder()

Get a new query builder instance for the connection.

protected newBaseQueryBuilder() : Builder
Return values
Builder

newBelongsTo()

Instantiate a new BelongsTo relationship.

protected newBelongsTo(Builder $query, Model $child, string $foreignKey, string $ownerKey, string $relation) : BelongsTo
Parameters
$query : Builder
$child : Model
$foreignKey : string
$ownerKey : string
$relation : string
Return values
BelongsTo

newBelongsToMany()

Instantiate a new BelongsToMany relationship.

protected newBelongsToMany(Builder $query, Model $parent, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string $relationName = null ]) : BelongsToMany
Parameters
$query : Builder
$parent : Model
$table : string
$foreignPivotKey : string
$relatedPivotKey : string
$parentKey : string
$relatedKey : string
$relationName : string = null
Return values
BelongsToMany

newHasMany()

Instantiate a new HasMany relationship.

protected newHasMany(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasMany
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$localKey : string
Return values
HasMany

newHasManyThrough()

Instantiate a new HasManyThrough relationship.

protected newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, string $firstKey, string $secondKey, string $localKey, string $secondLocalKey) : HasManyThrough
Parameters
$query : Builder
$farParent : Model
$throughParent : Model
$firstKey : string
$secondKey : string
$localKey : string
$secondLocalKey : string
Return values
HasManyThrough

newHasOne()

Instantiate a new HasOne relationship.

protected newHasOne(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasOne
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$localKey : string
Return values
HasOne

newMorphMany()

Instantiate a new MorphMany relationship.

protected newMorphMany(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphMany
Parameters
$query : Builder
$parent : Model
$type : string
$id : string
$localKey : string
Return values
MorphMany

newMorphOne()

Instantiate a new MorphOne relationship.

protected newMorphOne(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphOne
Parameters
$query : Builder
$parent : Model
$type : string
$id : string
$localKey : string
Return values
MorphOne

newMorphTo()

Instantiate a new MorphTo relationship.

protected newMorphTo(Builder $query, Model $parent, string $foreignKey, string $ownerKey, string $type, string $relation) : MorphTo
Parameters
$query : Builder
$parent : Model
$foreignKey : string
$ownerKey : string
$type : string
$relation : string
Return values
MorphTo

newMorphToMany()

Instantiate a new HasManyThrough relationship.

protected newMorphToMany(Builder $query, Model $parent, string $name, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string $relationName = null ][, bool $inverse = false ]) : MorphToMany
Parameters
$query : Builder
$parent : Model
$name : string
$table : string
$foreignPivotKey : string
$relatedPivotKey : string
$parentKey : string
$relatedKey : string
$relationName : string = null
$inverse : bool = false
Return values
MorphToMany

newRelatedInstance()

Create a new model instance for a related model.

protected newRelatedInstance(string $class) : mixed
Parameters
$class : string
Return values
mixed

originalIsEquivalent()

Determine if the new and old values for a given key are equivalent.

protected originalIsEquivalent(string $key, mixed $current) : bool
Parameters
$key : string
$current : mixed
Return values
bool

performDeleteOnModel()

Perform the actual delete query on this model instance.

protected performDeleteOnModel() : void
Return values
void

performInsert()

Perform a model insert operation.

protected performInsert(Builder $query) : bool
Parameters
$query : Builder
Return values
bool

performUpdate()

Perform a model update operation.

protected performUpdate(Builder $query) : bool
Parameters
$query : Builder
Return values
bool

registerModelEvent()

Register a model event with the dispatcher.

protected static registerModelEvent(string $event, Closure|string $callback) : void
Parameters
$event : string
$callback : Closure|string
Return values
void

removeTableFromKey()

Remove the table name from a given key.

protected removeTableFromKey(string $key) : string
Parameters
$key : string
Return values
string

serializeDate()

Prepare a date for array / JSON serialization.

protected serializeDate(DateTimeInterface $date) : string
Parameters
$date : DateTimeInterface
Return values
string

setKeysForSaveQuery()

Set the keys for a save update query.

protected setKeysForSaveQuery(Builder $query) : Builder
Parameters
$query : Builder
Return values
Builder

updateTimestamps()

Update the creation and update timestamps.

protected updateTimestamps() : void
Return values
void

Search results