class DatabaseNotification extends Model (View source)

Traits

Constants

CREATED_AT

The name of the "created at" column.

UPDATED_AT

The name of the "updated at" column.

Properties

protected array $attributes

The model's attributes.

from  HasAttributes
protected array $original

The model attribute's original state.

from  HasAttributes
protected array $changes

The changed model attributes.

from  HasAttributes
protected array $casts

The attributes that should be cast to native types.

protected array $classCastCache

The attributes that have been cast using custom classes.

from  HasAttributes
protected array $attributeCastCache

The attributes that have been cast using "Attribute" return type mutators.

from  HasAttributes
static protected string[] $primitiveCastTypes

The built-in, primitive cast types supported by Eloquent.

from  HasAttributes
protected string|null $dateFormat

The storage format of the model's date columns.

from  HasAttributes
protected array $appends

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

from  HasAttributes
static bool $snakeAttributes

Indicates whether attributes are snake cased on arrays.

from  HasAttributes
static protected array $mutatorCache

The cache of the mutated attributes for each class.

from  HasAttributes
static protected array $attributeMutatorCache

The cache of the "Attribute" return type marked mutated attributes for each class.

from  HasAttributes
static protected array $getAttributeMutatorCache

The cache of the "Attribute" return type marked mutated, gettable attributes for each class.

from  HasAttributes
static protected array $setAttributeMutatorCache

The cache of the "Attribute" return type marked mutated, settable attributes for each class.

from  HasAttributes
static protected array $castTypeCache

The cache of the converted cast types.

from  HasAttributes
static Encrypter|null $encrypter

The encrypter instance that is used to encrypt attributes.

from  HasAttributes
protected array $dispatchesEvents

The event map for the model.

from  HasEvents
protected array $observables

User exposed observable events.

from  HasEvents
protected array $relations

The loaded relationships for the model.

from  HasRelationships
protected array $touches

The relationships that should be touched on save.

from  HasRelationships
static string[] $manyMethods

The many to many relationship methods.

from  HasRelationships
static protected array $relationResolvers

The relation resolver callbacks.

from  HasRelationships
bool $timestamps

Indicates if the model should be timestamped.

from  HasTimestamps
static protected array $ignoreTimestampsOn

The list of models classes that have timestamps temporarily disabled.

from  HasTimestamps
bool $usesUniqueIds

Indicates if the model uses unique ids.

from  HasUniqueIds
protected string[] $hidden

The attributes that should be hidden for serialization.

from  HidesAttributes
protected string[] $visible

The attributes that should be visible in serialization.

from  HidesAttributes
protected array<int,string> $fillable

The attributes that are mass assignable.

from  GuardsAttributes
protected array $guarded

The guarded attributes on the model.

static protected bool $unguarded

Indicates if all mass assignment is enabled.

from  GuardsAttributes
static protected string[] $guardableColumns

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

from  GuardsAttributes
static protected WeakMap<static,array<string,mixed>> $recursionCache

The cache of objects processed to prevent infinite recursion.

from  PreventsCircularRecursion
static protected $resolvedCollectionClasses from  HasCollection
protected string|null $connection

The connection name for the model.

from  Model
protected string $table

The table associated with the model.

protected string $primaryKey

The primary key for the model.

from  Model
protected string $keyType

The "type" of the primary key ID.

bool $incrementing

Indicates if the IDs are auto-incrementing.

protected array $with

The relations to eager load on every query.

from  Model
protected array $withCount

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

from  Model
bool $preventsLazyLoading

Indicates whether lazy loading will be prevented on this model.

from  Model
protected int $perPage

The number of models to return for pagination.

from  Model
bool $exists

Indicates if the model exists.

from  Model
bool $wasRecentlyCreated

Indicates if the model was inserted during the object's lifecycle.

from  Model
protected bool $escapeWhenCastingToString

Indicates that the object's string representation should be escaped when __toString is invoked.

from  Model
static protected ConnectionResolverInterface $resolver

The connection resolver instance.

from  Model
static protected Dispatcher|null $dispatcher

The event dispatcher instance.

from  Model
static protected array $booted

The array of booted models.

from  Model
static protected array $traitInitializers

The array of trait initializers that will be called on each new instance.

from  Model
static protected array $globalScopes

The array of global scopes on the model.

from  Model
static protected array $ignoreOnTouch

The list of models classes that should not be affected with touch.

from  Model
static protected bool $modelsShouldPreventLazyLoading

Indicates whether lazy loading should be restricted on all models.

from  Model
static protected callable|null $lazyLoadingViolationCallback

The callback that is responsible for handling lazy loading violations.

from  Model
static protected bool $modelsShouldPreventSilentlyDiscardingAttributes

Indicates if an exception should be thrown instead of silently discarding non-fillable attributes.

from  Model
static protected callable|null $discardedAttributeViolationCallback

The callback that is responsible for handling discarded attribute violations.

from  Model
static protected bool $modelsShouldPreventAccessingMissingAttributes

Indicates if an exception should be thrown when trying to access a missing attribute on a retrieved model.

from  Model
static protected callable|null $missingAttributeViolationCallback

The callback that is responsible for handling missing attribute violations.

from  Model
static protected bool $isBroadcasting

Indicates if broadcasting is currently enabled.

from  Model
static protected $builder

The Eloquent query builder class to use for the model.

from  Model
static protected $collectionClass

The type of collection that should be used for the model.

Methods

void
initializeHasAttributes()

Initialize the trait.

array
attributesToArray()

Convert the model's attributes to an array.

array
addDateAttributesToArray(array $attributes)

Add the date attributes to the attributes array.

array
addMutatedAttributesToArray(array $attributes, array $mutatedAttributes)

Add the mutated attributes to the attributes array.

array
addCastAttributesToArray(array $attributes, array $mutatedAttributes)

Add the casted attributes to the attributes array.

array
getArrayableAttributes()

Get an attribute array of all arrayable attributes.

array
getArrayableAppends()

Get all of the appendable values that are arrayable.

array
relationsToArray()

Get the model's relationships in array form.

array
getArrayableRelations()

Get an attribute array of all arrayable relations.

array
getArrayableItems(array $values)

Get an attribute array of all arrayable values.

bool
hasAttribute(string $key)

Determine whether an attribute exists on the model.

mixed
getAttribute(string $key)

Get an attribute from the model.

null
throwMissingAttributeExceptionIfApplicable(string $key)

Either throw a missing attribute exception or return null depending on Eloquent's configuration.

mixed
getAttributeValue(string $key)

Get a plain attribute (not a relationship).

mixed
getAttributeFromArray(string $key)

Get an attribute from the $attributes array.

mixed
getRelationValue(string $key)

Get a relationship.

bool
isRelation(string $key)

Determine if the given key is a relationship method on the model.

mixed
handleLazyLoadingViolation(string $key)

Handle a lazy loading violation.

mixed
getRelationshipFromMethod(string $method)

Get a relationship value from a method.

bool
hasGetMutator(string $key)

Determine if a get mutator exists for an attribute.

bool
hasAttributeMutator(string $key)

Determine if a "Attribute" return type marked mutator exists for an attribute.

bool
hasAttributeGetMutator(string $key)

Determine if a "Attribute" return type marked get mutator exists for an attribute.

mixed
mutateAttribute(string $key, mixed $value)

Get the value of an attribute using its mutator.

mixed
mutateAttributeMarkedAttribute(string $key, mixed $value)

Get the value of an "Attribute" return type marked attribute using its mutator.

mixed
mutateAttributeForArray(string $key, mixed $value)

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

$this
mergeCasts(array $casts)

Merge new casts with existing casts on the model.

array
ensureCastsAreStringValues(array $casts)

Ensure that the given casts are strings.

mixed
castAttribute(string $key, mixed $value)

Cast an attribute to a native PHP type.

mixed
getClassCastableAttributeValue(string $key, mixed $value)

Cast the given attribute using a custom cast class.

mixed
getEnumCastableAttributeValue(string $key, mixed $value)

Cast the given attribute to an enum.

string
getCastType(string $key)

Get the type of cast for a model attribute.

mixed
deviateClassCastableAttribute(string $method, string $key, mixed $value)

Increment or decrement the given attribute using the custom cast class.

mixed
serializeClassCastableAttribute(string $key, mixed $value)

Serialize the given attribute using the custom cast class.

bool
isCustomDateTimeCast(string $cast)

Determine if the cast type is a custom date time cast.

bool
isImmutableCustomDateTimeCast(string $cast)

Determine if the cast type is an immutable custom date time cast.

bool
isDecimalCast(string $cast)

Determine if the cast type is a decimal cast.

mixed
setAttribute(string $key, mixed $value)

Set a given attribute on the model.

bool
hasSetMutator(string $key)

Determine if a set mutator exists for an attribute.

bool
hasAttributeSetMutator(string $key)

Determine if an "Attribute" return type marked set mutator exists for an attribute.

mixed
setMutatedAttributeValue(string $key, mixed $value)

Set the value of an attribute using its mutator.

mixed
setAttributeMarkedMutatedAttributeValue(string $key, mixed $value)

Set the value of a "Attribute" return type marked attribute using its mutator.

bool
isDateAttribute(string $key)

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

$this
fillJsonAttribute(string $key, mixed $value)

Set a given JSON attribute on the model.

void
setClassCastableAttribute(string $key, mixed $value)

Set the value of a class castable attribute.

void
setEnumCastableAttribute(string $key, UnitEnum|string|int|null $value)

Set the value of an enum castable attribute.

UnitEnum|BackedEnum
getEnumCaseFromValue(string $enumClass, string|int $value)

Get an enum case instance from a given class and value.

string|int
getStorableEnumValue(string $expectedEnum, UnitEnum|BackedEnum $value)

Get the storable value from the given enum.

$this
getArrayAttributeWithValue(string $path, string $key, mixed $value)

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

array
getArrayAttributeByKey(string $key)

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

string
castAttributeAsJson(string $key, mixed $value)

Cast the given attribute to JSON.

string
asJson(mixed $value)

Encode the given value as JSON.

mixed
fromJson(string|null $value, bool $asObject = false)

Decode the given JSON back into an array or object.

mixed
fromEncryptedString(string $value)

Decrypt the given encrypted string.

string
castAttributeAsEncryptedString(string $key, mixed $value)

Cast the given attribute to an encrypted string.

static void
encryptUsing(Encrypter|null $encrypter)

Set the encrypter instance that will be used to encrypt attributes.

static Encrypter
currentEncrypter()

Get the current encrypter being used by the model.

string
castAttributeAsHashedString(string $key, mixed $value)

Cast the given attribute to a hashed string.

mixed
fromFloat(mixed $value)

Decode the given float.

string
asDecimal(float|string $value, int $decimals)

Return a decimal as string.

asDate(mixed $value)

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

asDateTime(mixed $value)

Return a timestamp as DateTime object.

bool
isStandardDateFormat(string $value)

Determine if the given value is a standard date format.

string|null
fromDateTime(mixed $value)

Convert a DateTime to a storable string.

int
asTimestamp(mixed $value)

Return a timestamp as unix timestamp.

string
serializeDate(DateTimeInterface $date)

Prepare a date for array / JSON serialization.

array
getDates()

Get the attributes that should be converted to dates.

string
getDateFormat()

Get the format for database stored dates.

$this
setDateFormat(string $format)

Set the date format used by the model.

bool
hasCast(string $key, array|string|null $types = null)

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

array
getCasts()

Get the attributes that should be cast.

array<string,string>
casts()

Get the attributes that should be cast.

bool
isDateCastable(string $key)

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

bool
isDateCastableWithCustomFormat(string $key)

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

bool
isJsonCastable(string $key)

Determine whether a value is JSON castable for inbound manipulation.

bool
isEncryptedCastable(string $key)

Determine whether a value is an encrypted castable for inbound manipulation.

bool
isClassCastable(string $key)

Determine if the given key is cast using a custom class.

bool
isEnumCastable(string $key)

Determine if the given key is cast using an enum.

bool
isClassDeviable(string $key)

Determine if the key is deviable using a custom class.

bool
isClassSerializable(string $key)

Determine if the key is serializable using a custom class.

mixed
resolveCasterClass(string $key)

Resolve the custom caster class for a given key.

string
parseCasterClass(string $class)

Parse the given caster class, removing any arguments.

void
mergeAttributesFromCachedCasts()

Merge the cast class and attribute cast attributes back into the model.

void
mergeAttributesFromClassCasts()

Merge the cast class attributes back into the model.

void
mergeAttributesFromAttributeCasts()

Merge the cast class attributes back into the model.

array
normalizeCastClassResponse(string $key, mixed $value)

Normalize the response from a custom class caster.

array
getAttributes()

Get all of the current attributes on the model.

array
getAttributesForInsert()

Get all of the current attributes on the model for an insert operation.

$this
setRawAttributes(array $attributes, bool $sync = false)

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

mixed|array
getOriginal(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

mixed|array
getOriginalWithoutRewindingModel(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

mixed|array
getRawOriginal(string|null $key = null, mixed $default = null)

Get the model's raw original attribute values.

array
only(array|mixed $attributes)

Get a subset of the model's attributes.

$this
syncOriginal()

Sync the original attributes with the current.

$this
syncOriginalAttribute(string $attribute)

Sync a single original attribute with its current value.

$this
syncOriginalAttributes(array|string $attributes)

Sync multiple original attribute with their current values.

$this
syncChanges()

Sync the changed attributes.

bool
isDirty(array|string|null $attributes = null)

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

bool
isClean(array|string|null $attributes = null)

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

$this
discardChanges()

Discard attribute changes and reset the attributes to their original state.

bool
wasChanged(array|string|null $attributes = null)

Determine if the model or any of the given attribute(s) were changed when the model was last saved.

bool
hasChanges(array $changes, array|string|null $attributes = null)

Determine if any of the given attributes were changed when the model was last saved.

array
getDirty()

Get the attributes that have been changed since the last sync.

array
getDirtyForUpdate()

Get the attributes that have been changed since the last sync for an update operation.

array
getChanges()

Get the attributes that were changed when the model was last saved.

bool
originalIsEquivalent(string $key)

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

mixed
transformModelValue(string $key, mixed $value)

Transform a raw model value using mutators, casts, etc.

$this
append(array|string $attributes)

Append attributes to query when building a query.

array
getAppends()

Get the accessors that are being appended to model arrays.

$this
setAppends(array $appends)

Set the accessors to append to model arrays.

bool
hasAppended(string $attribute)

Return whether the accessor attribute has been appended.

array
getMutatedAttributes()

Get the mutated attributes for a given instance.

static void
cacheMutatedAttributes(object|string $classOrInstance)

Extract and cache all the mutated attributes of a class.

static array
getMutatorMethods(mixed $class)

Get all of the attribute mutator methods.

static array
getAttributeMarkedMutatorMethods(mixed $class)

Get all of the "Attribute" return typed attribute mutator methods.

static void
bootHasEvents()

Boot the has event trait for a model.

static array
resolveObserveAttributes()

Resolve the observe class names from the attributes.

static void
observe(object|array|string $classes)

Register observers with the model.

void
registerObserver(object|string $class)

Register a single observer with the model.

array
getObservableEvents()

Get the observable event names.

$this
setObservableEvents(array $observables)

Set the observable event names.

void
addObservableEvents(array|mixed $observables)

Add an observable event name.

void
removeObservableEvents(array|mixed $observables)

Remove an observable event name.

static void
registerModelEvent(string $event, QueuedClosure|callable|array|class-string $callback)

Register a model event with the dispatcher.

mixed
fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model.

mixed|null
fireCustomModelEvent(string $event, string $method)

Fire a custom model event for the given event.

mixed
filterModelEventResults(mixed $result)

Filter the model event results.

static void
retrieved(QueuedClosure|callable|array|class-string $callback)

Register a retrieved model event with the dispatcher.

static void
saving(QueuedClosure|callable|array|class-string $callback)

Register a saving model event with the dispatcher.

static void
saved(QueuedClosure|callable|array|class-string $callback)

Register a saved model event with the dispatcher.

static void
updating(QueuedClosure|callable|array|class-string $callback)

Register an updating model event with the dispatcher.

static void
updated(QueuedClosure|callable|array|class-string $callback)

Register an updated model event with the dispatcher.

static void
creating(QueuedClosure|callable|array|class-string $callback)

Register a creating model event with the dispatcher.

static void
created(QueuedClosure|callable|array|class-string $callback)

Register a created model event with the dispatcher.

static void
replicating(QueuedClosure|callable|array|class-string $callback)

Register a replicating model event with the dispatcher.

static void
deleting(QueuedClosure|callable|array|class-string $callback)

Register a deleting model event with the dispatcher.

static void
deleted(QueuedClosure|callable|array|class-string $callback)

Register a deleted model event with the dispatcher.

static void
flushEventListeners()

Remove all the event listeners for the model.

array
dispatchesEvents()

Get the event map for the model.

static Dispatcher|null
getEventDispatcher()

Get the event dispatcher instance.

static void
setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

static void
unsetEventDispatcher()

Unset the event dispatcher for models.

static mixed
withoutEvents(callable $callback)

Execute a callback without firing any model events for any model type.

static void
bootHasGlobalScopes()

Boot the has global scopes trait for a model.

static array
resolveGlobalScopeAttributes()

Resolve the global scope class names from the attributes.

static mixed
addGlobalScope(Scope|Closure|string $scope, Scope|Closure|null $implementation = null)

Register a new global scope on the model.

static void
addGlobalScopes(array $scopes)

Register multiple global scopes on the model.

static bool
hasGlobalScope(Scope|string $scope)

Determine if a model has a global scope.

static Scope|Closure|null
getGlobalScope(Scope|string $scope)

Get a global scope registered with the model.

static array
getAllGlobalScopes()

Get all of the global scopes that are currently registered.

static void
setAllGlobalScopes(array $scopes)

Set the current global scopes.

array
getGlobalScopes()

Get the global scopes for this class instance.

mixed
relationResolver(string $class, string $key)

Get the dynamic relation resolver if defined or inherited, or return null.

static void
resolveRelationUsing(string $name, Closure $callback)

Define a dynamic relation resolver.

TRelatedModel,$this>
hasOne(TRelatedModel> $related, string|null $foreignKey = null, string|null $localKey = null)

Define a one-to-one relationship.

TDeclaringModel>
newHasOne(Builder $query, Model $parent, string $foreignKey, string $localKey)

Instantiate a new HasOne relationship.

hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)

No description

newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey)

No description

TRelatedModel,$this>
morphOne(TRelatedModel> $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null)

Define a polymorphic one-to-one relationship.

TDeclaringModel>
newMorphOne(Builder $query, Model $parent, string $type, string $id, string $localKey)

Instantiate a new MorphOne relationship.

TRelatedModel,$this>
belongsTo(TRelatedModel> $related, string|null $foreignKey = null, string|null $ownerKey = null, string|null $relation = null)

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

TDeclaringModel>
newBelongsTo(Builder $query, Model $child, string $foreignKey, string $ownerKey, string $relation)

Instantiate a new BelongsTo relationship.

Model,$this>
morphTo(string|null $name = null, string|null $type = null, string|null $id = null, string|null $ownerKey = null)

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

Model,$this>
morphEagerTo(string $name, string $type, string $id, string|null $ownerKey)

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

Model,$this>
morphInstanceTo(string $target, string $name, string $type, string $id, string|null $ownerKey)

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

TDeclaringModel>
newMorphTo(Builder $query, Model $parent, string $foreignKey, string|null $ownerKey, string $type, string $relation)

Instantiate a new MorphTo relationship.

static string
getActualClassNameForMorph(string $class)

Retrieve the actual class name for a given morph class.

string
guessBelongsToRelation()

Guess the "belongs to" relationship name.

through($relationship)

Create a pending has-many-through or has-one-through relationship.

TRelatedModel,$this>
hasMany(TRelatedModel> $related, string|null $foreignKey = null, string|null $localKey = null)

Define a one-to-many relationship.

TDeclaringModel>
newHasMany(Builder $query, Model $parent, string $foreignKey, string $localKey)

Instantiate a new HasMany relationship.

hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)

No description

newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey)

No description

TRelatedModel,$this>
morphMany(TRelatedModel> $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null)

Define a polymorphic one-to-many relationship.

TDeclaringModel>
newMorphMany(Builder $query, Model $parent, string $type, string $id, string $localKey)

Instantiate a new MorphMany relationship.

TRelatedModel,$this>
belongsToMany(TRelatedModel> $related, string|Model>|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null)

Define a many-to-many relationship.

TDeclaringModel>
newBelongsToMany(Builder $query, Model $parent, string|Model> $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey, string|null $relationName = null)

Instantiate a new BelongsToMany relationship.

TRelatedModel,$this>
morphToMany(TRelatedModel> $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null, bool $inverse = false)

Define a polymorphic many-to-many relationship.

TDeclaringModel>
newMorphToMany(Builder $query, Model $parent, string $name, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey, string|null $relationName = null, bool $inverse = false)

Instantiate a new MorphToMany relationship.

TRelatedModel,$this>
morphedByMany(TRelatedModel> $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null)

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

string|null
guessBelongsToManyRelation()

Get the relationship name of the belongsToMany relationship.

string
joiningTable(string $related, Model|null $instance = null)

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

string
joiningTableSegment()

Get this model's half of the intermediate table name for belongsToMany relationships.

bool
touches(string $relation)

Determine if the model touches a given relation.

void
touchOwners()

Touch the owning relations of the model.

array
getMorphs(string $name, string $type, string $id)

Get the polymorphic relationship columns.

string
getMorphClass()

Get the class name for polymorphic relations.

mixed
newRelatedInstance(string $class)

Create a new model instance for a related model.

mixed
newRelatedThroughInstance(string $class)

Create a new model instance for a related "through" model.

array
getRelations()

Get all the loaded relations for the instance.

mixed
getRelation(string $relation)

Get a specified relationship.

bool
relationLoaded(string $key)

Determine if the given relation is loaded.

$this
setRelation(string $relation, mixed $value)

Set the given relationship on the model.

$this
unsetRelation(string $relation)

Unset a loaded relationship.

$this
setRelations(array $relations)

Set the entire relations array on the model.

$this
withoutRelations()

Duplicate the instance and unset all the loaded relations.

$this
unsetRelations()

Unset all the loaded relations for the instance.

array
getTouchedRelations()

Get the relationships that are touched on save.

$this
setTouchedRelations(array $touches)

Set the relationships that are touched on save.

bool
touch(string|null $attribute = null)

Update the model's update timestamp.

bool
touchQuietly(string|null $attribute = null)

Update the model's update timestamp without raising any events.

$this
updateTimestamps()

Update the creation and update timestamps.

$this
setCreatedAt(mixed $value)

Set the value of the "created at" attribute.

$this
setUpdatedAt(mixed $value)

Set the value of the "updated at" attribute.

freshTimestamp()

Get a fresh timestamp for the model.

string
freshTimestampString()

Get a fresh timestamp for the model.

bool
usesTimestamps()

Determine if the model uses timestamps.

string|null
getCreatedAtColumn()

Get the name of the "created at" column.

string|null
getUpdatedAtColumn()

Get the name of the "updated at" column.

string|null
getQualifiedCreatedAtColumn()

Get the fully qualified "created at" column.

string|null
getQualifiedUpdatedAtColumn()

Get the fully qualified "updated at" column.

static mixed
withoutTimestamps(callable $callback)

Disable timestamps for the current class during the given callback scope.

static mixed
withoutTimestampsOn(array $models, callable $callback)

Disable timestamps for the given model classes during the given callback scope.

static bool
isIgnoringTimestamps(string|null $class = null)

Determine if the given model is ignoring timestamps / touches.

bool
usesUniqueIds()

Determine if the model uses unique ids.

void
setUniqueIds()

Generate unique keys for the model.

string
newUniqueId()

Generate a new key for the model.

array
uniqueIds()

Get the columns that should receive a unique identifier.

string[]
getHidden()

Get the hidden attributes for the model.

$this
setHidden(array $hidden)

Set the hidden attributes for the model.

string[]
getVisible()

Get the visible attributes for the model.

$this
setVisible(array $visible)

Set the visible attributes for the model.

$this
makeVisible(string[]|string|null $attributes)

Make the given, typically hidden, attributes visible.

$this
makeVisibleIf(bool|Closure $condition, string[]|string|null $attributes)

Make the given, typically hidden, attributes visible if the given truth test passes.

$this
makeHidden(string[]|string|null $attributes)

Make the given, typically visible, attributes hidden.

$this
makeHiddenIf(bool|Closure $condition, string[]|string|null $attributes)

Make the given, typically visible, attributes hidden if the given truth test passes.

string[]
getFillable()

Get the fillable attributes for the model.

$this
fillable(array $fillable)

Set the fillable attributes for the model.

$this
mergeFillable(array $fillable)

Merge new fillable attributes with existing fillable attributes on the model.

string[]
getGuarded()

Get the guarded attributes for the model.

$this
guard(array $guarded)

Set the guarded attributes for the model.

$this
mergeGuarded(array $guarded)

Merge new guarded attributes with existing guarded attributes on the model.

static void
unguard(bool $state = true)

Disable all mass assignable restrictions.

static void
reguard()

Enable the mass assignment restrictions.

static bool
isUnguarded()

Determine if the current state is "unguarded".

static mixed
unguarded(callable $callback)

Run the given callable while being unguarded.

bool
isFillable(string $key)

Determine if the given attribute may be mass assigned.

bool
isGuarded(string $key)

Determine if the given key is guarded.

bool
isGuardableColumn(string $key)

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

bool
totallyGuarded()

Determine if the model is totally guarded.

array
fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

mixed
withoutRecursion(callable $callback, mixed $default = null)

Prevent a method from being called multiple times on the same object within the same call stack.

static 
clearRecursiveCallValue(object $object, string $hash)

Remove an entry from the recursion cache for an object.

static array
getRecursiveCallStack(object $object)

Get the stack of methods being called recursively for the current object.

static WeakMap
getRecursionCache()

Get the current recursion cache being used by the model.

static mixed
setRecursiveCallValue(object $object, string $hash, mixed $value)

Set a value in the recursion cache for the given object and method.

mixed
forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

mixed
forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

static never
throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

TCollection
newCollection(array $models = [])

Create a new Eloquent Collection instance.

TCollection>|null
resolveCollectionFromAttribute()

Resolve the collection class name from the CollectedBy attribute.

void
__construct(array $attributes = [])

Create a new Eloquent model instance.

from  Model
void
bootIfNotBooted()

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

from  Model
static void
booting()

Perform any actions required before the model boots.

from  Model
static void
boot()

Bootstrap the model and its traits.

from  Model
static void
bootTraits()

Boot all of the bootable traits on the model.

from  Model
void
initializeTraits()

Initialize any initializable traits on the model.

from  Model
static void
booted()

Perform any actions required after the model boots.

from  Model
static void
clearBootedModels()

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

from  Model
static void
withoutTouching(callable $callback)

Disables relationship model touching for the current class during given callback scope.

from  Model
static void
withoutTouchingOn(array $models, callable $callback)

Disables relationship model touching for the given model classes during given callback scope.

from  Model
static bool
isIgnoringTouch(string|null $class = null)

Determine if the given model is ignoring touches.

from  Model
static void
shouldBeStrict(bool $shouldBeStrict = true)

Indicate that models should prevent lazy loading, silently discarding attributes, and accessing missing attributes.

from  Model
static void
preventLazyLoading(bool $value = true)

Prevent model relationships from being lazy loaded.

from  Model
static void
handleLazyLoadingViolationUsing(callable|null $callback)

Register a callback that is responsible for handling lazy loading violations.

from  Model
static void
preventSilentlyDiscardingAttributes(bool $value = true)

Prevent non-fillable attributes from being silently discarded.

from  Model
static void
handleDiscardedAttributeViolationUsing(callable|null $callback)

Register a callback that is responsible for handling discarded attribute violations.

from  Model
static void
preventAccessingMissingAttributes(bool $value = true)

Prevent accessing missing attributes on retrieved models.

from  Model
static void
handleMissingAttributeViolationUsing(callable|null $callback)

Register a callback that is responsible for handling missing attribute violations.

from  Model
static mixed
withoutBroadcasting(callable $callback)

Execute a callback without broadcasting any model events for all model types.

from  Model
$this
fill(array $attributes)

Fill the model with an array of attributes.

from  Model
$this
forceFill(array $attributes)

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

from  Model
string
qualifyColumn(string $column)

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

from  Model
array
qualifyColumns(array $columns)

Qualify the given columns with the model's table.

from  Model
newInstance(array $attributes = [], bool $exists = false)

Create a new instance of the given model.

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

Create a new model instance that is existing.

from  Model
static Builder<static>
on(string|null $connection = null)

Begin querying the model on a given connection.

from  Model
static Builder<static>
onWriteConnection()

Begin querying the model on the write connection.

from  Model
static Collection<int,static>
all(array|string $columns = ['*'])

Get all of the models from the database.

from  Model
static Builder<static>
with(array|string $relations)

Begin querying a model with eager loading.

from  Model
$this
load(array|string $relations)

Eager load relations on the model.

from  Model
$this
loadMorph(string $relation, array $relations)

Eager load relationships on the polymorphic relation of a model.

from  Model
$this
loadMissing(array|string $relations)

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

from  Model
$this
loadAggregate(array|string $relations, string $column, string|null $function = null)

Eager load relation's column aggregations on the model.

from  Model
$this
loadCount(array|string $relations)

Eager load relation counts on the model.

from  Model
$this
loadMax(array|string $relations, string $column)

Eager load relation max column values on the model.

from  Model
$this
loadMin(array|string $relations, string $column)

Eager load relation min column values on the model.

from  Model
$this
loadSum(array|string $relations, string $column)

Eager load relation's column summations on the model.

from  Model
$this
loadAvg(array|string $relations, string $column)

Eager load relation average column values on the model.

from  Model
$this
loadExists(array|string $relations)

Eager load related model existence values on the model.

from  Model
$this
loadMorphAggregate(string $relation, array $relations, string $column, string|null $function = null)

Eager load relationship column aggregation on the polymorphic relation of a model.

from  Model
$this
loadMorphCount(string $relation, array $relations)

Eager load relationship counts on the polymorphic relation of a model.

from  Model
$this
loadMorphMax(string $relation, array $relations, string $column)

Eager load relationship max column values on the polymorphic relation of a model.

from  Model
$this
loadMorphMin(string $relation, array $relations, string $column)

Eager load relationship min column values on the polymorphic relation of a model.

from  Model
$this
loadMorphSum(string $relation, array $relations, string $column)

Eager load relationship column summations on the polymorphic relation of a model.

from  Model
$this
loadMorphAvg(string $relation, array $relations, string $column)

Eager load relationship average column values on the polymorphic relation of a model.

from  Model
int
increment(string $column, float|int $amount = 1, array $extra = [])

Increment a column's value by a given amount.

from  Model
int
decrement(string $column, float|int $amount = 1, array $extra = [])

Decrement a column's value by a given amount.

from  Model
int
incrementOrDecrement(string $column, float|int $amount, array $extra, string $method)

Run the increment or decrement method on the model.

from  Model
bool
update(array $attributes = [], array $options = [])

Update the model in the database.

from  Model
bool
updateOrFail(array $attributes = [], array $options = [])

Update the model in the database within a transaction.

from  Model
bool
updateQuietly(array $attributes = [], array $options = [])

Update the model in the database without raising any events.

from  Model
int
incrementQuietly(string $column, float|int $amount = 1, array $extra = [])

Increment a column's value by a given amount without raising any events.

from  Model
int
decrementQuietly(string $column, float|int $amount = 1, array $extra = [])

Decrement a column's value by a given amount without raising any events.

from  Model
bool
push()

Save the model and all of its relationships.

from  Model
bool
pushQuietly()

Save the model and all of its relationships without raising any events to the parent model.

from  Model
bool
saveQuietly(array $options = [])

Save the model to the database without raising any events.

from  Model
bool
save(array $options = [])

Save the model to the database.

from  Model
bool
saveOrFail(array $options = [])

Save the model to the database within a transaction.

from  Model
void
finishSave(array $options)

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

from  Model
bool
performUpdate(Builder $query)

Perform a model update operation.

from  Model
Builder<static>
setKeysForSelectQuery(Builder<static> $query)

Set the keys for a select query.

from  Model
mixed
getKeyForSelectQuery()

Get the primary key value for a select query.

from  Model
Builder<static>
setKeysForSaveQuery(Builder<static> $query)

Set the keys for a save update query.

from  Model
mixed
getKeyForSaveQuery()

Get the primary key value for a save query.

from  Model
bool
performInsert(Builder $query)

Perform a model insert operation.

from  Model
void
insertAndSetId(Builder $query, array $attributes)

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

from  Model
static int
destroy(Collection|array|int|string $ids)

Destroy the models for the given IDs.

from  Model
bool|null
delete()

Delete the model from the database.

from  Model
bool
deleteQuietly()

Delete the model from the database without raising any events.

from  Model
bool|null
deleteOrFail()

Delete the model from the database within a transaction.

from  Model
bool|null
forceDelete()

Force a hard delete on a soft deleted model.

from  Model
static bool|null
forceDestroy(Collection|array|int|string $ids)

Force a hard destroy on a soft deleted model.

from  Model
void
performDeleteOnModel()

Perform the actual delete query on this model instance.

from  Model
static Builder<static>
query()

Begin querying the model.

from  Model
Builder<static>
newQuery()

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

from  Model
Builder<static>
newModelQuery()

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

from  Model
Builder<static>
newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

from  Model
Builder<static>
registerGlobalScopes(Builder<static> $builder)

Register the global scopes for this builder instance.

from  Model
Builder<static>
newQueryWithoutScopes()

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

from  Model
Builder<static>
newQueryWithoutScope(Scope|string $scope)

Get a new query instance without a given scope.

from  Model
Builder<static>
newQueryForRestoration(array|int $ids)

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

from  Model
newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

from  Model
newBaseQueryBuilder()

Get a new query builder instance for the connection.

from  Model
newPivot(Model $parent, array $attributes, string $table, bool $exists, string|null $using = null)

Create a new pivot model instance.

from  Model
bool
hasNamedScope(string $scope)

Determine if the model has a given scope.

from  Model
mixed
callNamedScope(string $scope, array $parameters = [])

Apply the given named scope if possible.

from  Model
toArray()

Convert the model instance to an array.

from  Model
string
toJson(int $options = 0)

Convert the model instance to JSON.

from  Model
mixed
jsonSerialize()

Convert the object into something JSON serializable.

from  Model
Model|null
fresh(array|string $with = [])

Reload a fresh model instance from the database.

from  Model
$this
refresh()

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

from  Model
replicate(array|null $except = null)

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

from  Model
replicateQuietly(array|null $except = null)

Clone the model into a new, non-existing instance without raising any events.

from  Model
bool
is(Model|null $model)

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

from  Model
bool
isNot(Model|null $model)

Determine if two models are not the same.

from  Model
getConnection()

Get the database connection for the model.

from  Model
string|null
getConnectionName()

Get the current connection name for the model.

from  Model
$this
setConnection(string|null $name)

Set the connection associated with the model.

from  Model
static Connection
resolveConnection(string|null $connection = null)

Resolve a connection instance.

from  Model
getConnectionResolver()

Get the connection resolver instance.

from  Model
static void
setConnectionResolver(ConnectionResolverInterface $resolver)

Set the connection resolver instance.

from  Model
static void
unsetConnectionResolver()

Unset the connection resolver for models.

from  Model
string
getTable()

Get the table associated with the model.

from  Model
$this
setTable(string $table)

Set the table associated with the model.

from  Model
string
getKeyName()

Get the primary key for the model.

from  Model
$this
setKeyName(string $key)

Set the primary key for the model.

from  Model
string
getQualifiedKeyName()

Get the table qualified key name.

from  Model
string
getKeyType()

Get the auto-incrementing key type.

from  Model
$this
setKeyType(string $type)

Set the data type for the primary key.

from  Model
bool
getIncrementing()

Get the value indicating whether the IDs are incrementing.

from  Model
$this
setIncrementing(bool $value)

Set whether IDs are incrementing.

from  Model
mixed
getKey()

Get the value of the model's primary key.

from  Model
mixed
getQueueableId()

Get the queueable identity for the entity.

from  Model
array
getQueueableRelations()

Get the queueable relationships for the entity.

from  Model
string|null
getQueueableConnection()

Get the queueable connection for the entity.

from  Model
mixed
getRouteKey()

Get the value of the model's route key.

from  Model
string
getRouteKeyName()

Get the route key for the model.

from  Model
Model|null
resolveRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

from  Model
Model|null
resolveSoftDeletableRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

from  Model
Model|null
resolveChildRouteBinding(string $childType, mixed $value, string|null $field)

Retrieve the child model for a bound value.

from  Model
Model|null
resolveSoftDeletableChildRouteBinding(string $childType, mixed $value, string|null $field)

Retrieve the child model for a bound value.

from  Model
resolveChildRouteBindingQuery($childType, $value, $field)

No description

from  Model
string
childRouteBindingRelationshipName(string $childType)

Retrieve the child route model binding relationship name for the given child type.

from  Model
resolveRouteBindingQuery(Model|Builder|Relation $query, mixed $value, string|null $field = null)

Retrieve the model for a bound value.

from  Model
string
getForeignKey()

Get the default foreign key name for the model.

from  Model
int
getPerPage()

Get the number of models to return per page.

from  Model
$this
setPerPage(int $perPage)

Set the number of models to return per page.

from  Model
static bool
preventsLazyLoading()

Determine if lazy loading is disabled.

from  Model
static bool
preventsSilentlyDiscardingAttributes()

Determine if discarding guarded attribute fills is disabled.

from  Model
static bool
preventsAccessingMissingAttributes()

Determine if accessing missing attributes is disabled.

from  Model
string
broadcastChannelRoute()

Get the broadcast channel route definition that is associated with the given entity.

from  Model
string
broadcastChannel()

Get the broadcast channel name that is associated with the given entity.

from  Model
mixed
__get(string $key)

Dynamically retrieve attributes on the model.

from  Model
void
__set(string $key, mixed $value)

Dynamically set attributes on the model.

from  Model
bool
offsetExists(mixed $offset)

Determine if the given attribute exists.

from  Model
mixed
offsetGet(mixed $offset)

Get the value for a given offset.

from  Model
void
offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

from  Model
void
offsetUnset(mixed $offset)

Unset the value for a given offset.

from  Model
bool
__isset(string $key)

Determine if an attribute or relation exists on the model.

from  Model
void
__unset(string $key)

Unset an attribute on the model.

from  Model
mixed
__call(string $method, array $parameters)

Handle dynamic method calls into the model.

from  Model
static mixed
__callStatic(string $method, array $parameters)

Handle dynamic static method calls into the model.

from  Model
string
__toString()

Convert the model to its string representation.

from  Model
$this
escapeWhenCastingToString(bool $escape = true)

Indicate that the object's string representation should be escaped when __toString is invoked.

from  Model
array
__sleep()

Prepare the object for serialization.

from  Model
void
__wakeup()

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

from  Model
Model,$this>
notifiable()

Get the notifiable entity that the notification belongs to.

void
markAsRead()

Mark the notification as read.

void
markAsUnread()

Mark the notification as unread.

bool
read()

Determine if a notification has been read.

bool
unread()

Determine if a notification has not been read.

Builder<static>
scopeRead(Builder $query)

Scope a query to only include read notifications.

Builder<static>
scopeUnread(Builder $query)

Scope a query to only include unread notifications.

Details

protected void initializeHasAttributes()

Initialize the trait.

Return Value

void

array attributesToArray()

Convert the model's attributes to an array.

Return Value

array

protected array addDateAttributesToArray(array $attributes)

Add the date attributes to the attributes array.

Parameters

array $attributes

Return Value

array

protected array addMutatedAttributesToArray(array $attributes, array $mutatedAttributes)

Add the mutated attributes to the attributes array.

Parameters

array $attributes
array $mutatedAttributes

Return Value

array

protected array addCastAttributesToArray(array $attributes, array $mutatedAttributes)

Add the casted attributes to the attributes array.

Parameters

array $attributes
array $mutatedAttributes

Return Value

array

protected array getArrayableAttributes()

Get an attribute array of all arrayable attributes.

Return Value

array

protected array getArrayableAppends()

Get all of the appendable values that are arrayable.

Return Value

array

array relationsToArray()

Get the model's relationships in array form.

Return Value

array

protected array getArrayableRelations()

Get an attribute array of all arrayable relations.

Return Value

array

protected array getArrayableItems(array $values)

Get an attribute array of all arrayable values.

Parameters

array $values

Return Value

array

bool hasAttribute(string $key)

Determine whether an attribute exists on the model.

Parameters

string $key

Return Value

bool

mixed getAttribute(string $key)

Get an attribute from the model.

Parameters

string $key

Return Value

mixed

protected null throwMissingAttributeExceptionIfApplicable(string $key)

Either throw a missing attribute exception or return null depending on Eloquent's configuration.

Parameters

string $key

Return Value

null

Exceptions

MissingAttributeException

mixed getAttributeValue(string $key)

Get a plain attribute (not a relationship).

Parameters

string $key

Return Value

mixed

protected mixed getAttributeFromArray(string $key)

Get an attribute from the $attributes array.

Parameters

string $key

Return Value

mixed

mixed getRelationValue(string $key)

Get a relationship.

Parameters

string $key

Return Value

mixed

bool isRelation(string $key)

Determine if the given key is a relationship method on the model.

Parameters

string $key

Return Value

bool

protected mixed handleLazyLoadingViolation(string $key)

Handle a lazy loading violation.

Parameters

string $key

Return Value

mixed

protected mixed getRelationshipFromMethod(string $method)

Get a relationship value from a method.

Parameters

string $method

Return Value

mixed

Exceptions

LogicException

bool hasGetMutator(string $key)

Determine if a get mutator exists for an attribute.

Parameters

string $key

Return Value

bool

bool hasAttributeMutator(string $key)

Determine if a "Attribute" return type marked mutator exists for an attribute.

Parameters

string $key

Return Value

bool

bool hasAttributeGetMutator(string $key)

Determine if a "Attribute" return type marked get mutator exists for an attribute.

Parameters

string $key

Return Value

bool

protected mixed mutateAttribute(string $key, mixed $value)

Get the value of an attribute using its mutator.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed mutateAttributeMarkedAttribute(string $key, mixed $value)

Get the value of an "Attribute" return type marked attribute using its mutator.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed mutateAttributeForArray(string $key, mixed $value)

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

Parameters

string $key
mixed $value

Return Value

mixed

$this mergeCasts(array $casts)

Merge new casts with existing casts on the model.

Parameters

array $casts

Return Value

$this

protected array ensureCastsAreStringValues(array $casts)

Ensure that the given casts are strings.

Parameters

array $casts

Return Value

array

protected mixed castAttribute(string $key, mixed $value)

Cast an attribute to a native PHP type.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed getClassCastableAttributeValue(string $key, mixed $value)

Cast the given attribute using a custom cast class.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed getEnumCastableAttributeValue(string $key, mixed $value)

Cast the given attribute to an enum.

Parameters

string $key
mixed $value

Return Value

mixed

protected string getCastType(string $key)

Get the type of cast for a model attribute.

Parameters

string $key

Return Value

string

protected mixed deviateClassCastableAttribute(string $method, string $key, mixed $value)

Increment or decrement the given attribute using the custom cast class.

Parameters

string $method
string $key
mixed $value

Return Value

mixed

protected mixed serializeClassCastableAttribute(string $key, mixed $value)

Serialize the given attribute using the custom cast class.

Parameters

string $key
mixed $value

Return Value

mixed

protected bool isCustomDateTimeCast(string $cast)

Determine if the cast type is a custom date time cast.

Parameters

string $cast

Return Value

bool

protected bool isImmutableCustomDateTimeCast(string $cast)

Determine if the cast type is an immutable custom date time cast.

Parameters

string $cast

Return Value

bool

protected bool isDecimalCast(string $cast)

Determine if the cast type is a decimal cast.

Parameters

string $cast

Return Value

bool

mixed setAttribute(string $key, mixed $value)

Set a given attribute on the model.

Parameters

string $key
mixed $value

Return Value

mixed

bool hasSetMutator(string $key)

Determine if a set mutator exists for an attribute.

Parameters

string $key

Return Value

bool

bool hasAttributeSetMutator(string $key)

Determine if an "Attribute" return type marked set mutator exists for an attribute.

Parameters

string $key

Return Value

bool

protected mixed setMutatedAttributeValue(string $key, mixed $value)

Set the value of an attribute using its mutator.

Parameters

string $key
mixed $value

Return Value

mixed

protected mixed setAttributeMarkedMutatedAttributeValue(string $key, mixed $value)

Set the value of a "Attribute" return type marked attribute using its mutator.

Parameters

string $key
mixed $value

Return Value

mixed

protected bool isDateAttribute(string $key)

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

Parameters

string $key

Return Value

bool

$this fillJsonAttribute(string $key, mixed $value)

Set a given JSON attribute on the model.

Parameters

string $key
mixed $value

Return Value

$this

protected void setClassCastableAttribute(string $key, mixed $value)

Set the value of a class castable attribute.

Parameters

string $key
mixed $value

Return Value

void

protected void setEnumCastableAttribute(string $key, UnitEnum|string|int|null $value)

Set the value of an enum castable attribute.

Parameters

string $key
UnitEnum|string|int|null $value

Return Value

void

protected UnitEnum|BackedEnum getEnumCaseFromValue(string $enumClass, string|int $value)

Get an enum case instance from a given class and value.

Parameters

string $enumClass
string|int $value

Return Value

UnitEnum|BackedEnum

protected string|int getStorableEnumValue(string $expectedEnum, UnitEnum|BackedEnum $value)

Get the storable value from the given enum.

Parameters

string $expectedEnum
UnitEnum|BackedEnum $value

Return Value

string|int

protected $this getArrayAttributeWithValue(string $path, string $key, mixed $value)

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

Parameters

string $path
string $key
mixed $value

Return Value

$this

protected array getArrayAttributeByKey(string $key)

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

Parameters

string $key

Return Value

array

protected string castAttributeAsJson(string $key, mixed $value)

Cast the given attribute to JSON.

Parameters

string $key
mixed $value

Return Value

string

protected string asJson(mixed $value)

Encode the given value as JSON.

Parameters

mixed $value

Return Value

string

mixed fromJson(string|null $value, bool $asObject = false)

Decode the given JSON back into an array or object.

Parameters

string|null $value
bool $asObject

Return Value

mixed

mixed fromEncryptedString(string $value)

Decrypt the given encrypted string.

Parameters

string $value

Return Value

mixed

protected string castAttributeAsEncryptedString(string $key, mixed $value)

Cast the given attribute to an encrypted string.

Parameters

string $key
mixed $value

Return Value

string

static void encryptUsing(Encrypter|null $encrypter)

Set the encrypter instance that will be used to encrypt attributes.

Parameters

Encrypter|null $encrypter

Return Value

void

static protected Encrypter currentEncrypter()

Get the current encrypter being used by the model.

Return Value

Encrypter

protected string castAttributeAsHashedString(string $key, mixed $value)

Cast the given attribute to a hashed string.

Parameters

string $key
mixed $value

Return Value

string

mixed fromFloat(mixed $value)

Decode the given float.

Parameters

mixed $value

Return Value

mixed

protected string asDecimal(float|string $value, int $decimals)

Return a decimal as string.

Parameters

float|string $value
int $decimals

Return Value

string

protected Carbon asDate(mixed $value)

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

Parameters

mixed $value

Return Value

Carbon

protected Carbon asDateTime(mixed $value)

Return a timestamp as DateTime object.

Parameters

mixed $value

Return Value

Carbon

protected bool isStandardDateFormat(string $value)

Determine if the given value is a standard date format.

Parameters

string $value

Return Value

bool

string|null fromDateTime(mixed $value)

Convert a DateTime to a storable string.

Parameters

mixed $value

Return Value

string|null

protected int asTimestamp(mixed $value)

Return a timestamp as unix timestamp.

Parameters

mixed $value

Return Value

int

protected string serializeDate(DateTimeInterface $date)

Prepare a date for array / JSON serialization.

Parameters

DateTimeInterface $date

Return Value

string

array getDates()

Get the attributes that should be converted to dates.

Return Value

array

string getDateFormat()

Get the format for database stored dates.

Return Value

string

$this setDateFormat(string $format)

Set the date format used by the model.

Parameters

string $format

Return Value

$this

bool hasCast(string $key, array|string|null $types = null)

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

Parameters

string $key
array|string|null $types

Return Value

bool

array getCasts()

Get the attributes that should be cast.

Return Value

array

protected array<string,string> casts()

Get the attributes that should be cast.

Return Value

array<string,string>

protected bool isDateCastable(string $key)

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

Parameters

string $key

Return Value

bool

protected bool isDateCastableWithCustomFormat(string $key)

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

Parameters

string $key

Return Value

bool

protected bool isJsonCastable(string $key)

Determine whether a value is JSON castable for inbound manipulation.

Parameters

string $key

Return Value

bool

protected bool isEncryptedCastable(string $key)

Determine whether a value is an encrypted castable for inbound manipulation.

Parameters

string $key

Return Value

bool

protected bool isClassCastable(string $key)

Determine if the given key is cast using a custom class.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCastException

protected bool isEnumCastable(string $key)

Determine if the given key is cast using an enum.

Parameters

string $key

Return Value

bool

protected bool isClassDeviable(string $key)

Determine if the key is deviable using a custom class.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCastException

protected bool isClassSerializable(string $key)

Determine if the key is serializable using a custom class.

Parameters

string $key

Return Value

bool

Exceptions

InvalidCastException

protected mixed resolveCasterClass(string $key)

Resolve the custom caster class for a given key.

Parameters

string $key

Return Value

mixed

protected string parseCasterClass(string $class)

Parse the given caster class, removing any arguments.

Parameters

string $class

Return Value

string

protected void mergeAttributesFromCachedCasts()

Merge the cast class and attribute cast attributes back into the model.

Return Value

void

protected void mergeAttributesFromClassCasts()

Merge the cast class attributes back into the model.

Return Value

void

protected void mergeAttributesFromAttributeCasts()

Merge the cast class attributes back into the model.

Return Value

void

protected array normalizeCastClassResponse(string $key, mixed $value)

Normalize the response from a custom class caster.

Parameters

string $key
mixed $value

Return Value

array

array getAttributes()

Get all of the current attributes on the model.

Return Value

array

protected array getAttributesForInsert()

Get all of the current attributes on the model for an insert operation.

Return Value

array

$this setRawAttributes(array $attributes, bool $sync = false)

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

Parameters

array $attributes
bool $sync

Return Value

$this

mixed|array getOriginal(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

Parameters

string|null $key
mixed $default

Return Value

mixed|array

protected mixed|array getOriginalWithoutRewindingModel(string|null $key = null, mixed $default = null)

Get the model's original attribute values.

Parameters

string|null $key
mixed $default

Return Value

mixed|array

mixed|array getRawOriginal(string|null $key = null, mixed $default = null)

Get the model's raw original attribute values.

Parameters

string|null $key
mixed $default

Return Value

mixed|array

array only(array|mixed $attributes)

Get a subset of the model's attributes.

Parameters

array|mixed $attributes

Return Value

array

$this syncOriginal()

Sync the original attributes with the current.

Return Value

$this

$this syncOriginalAttribute(string $attribute)

Sync a single original attribute with its current value.

Parameters

string $attribute

Return Value

$this

$this syncOriginalAttributes(array|string $attributes)

Sync multiple original attribute with their current values.

Parameters

array|string $attributes

Return Value

$this

$this syncChanges()

Sync the changed attributes.

Return Value

$this

bool isDirty(array|string|null $attributes = null)

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

Parameters

array|string|null $attributes

Return Value

bool

bool isClean(array|string|null $attributes = null)

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

Parameters

array|string|null $attributes

Return Value

bool

$this discardChanges()

Discard attribute changes and reset the attributes to their original state.

Return Value

$this

bool wasChanged(array|string|null $attributes = null)

Determine if the model or any of the given attribute(s) were changed when the model was last saved.

Parameters

array|string|null $attributes

Return Value

bool

protected bool hasChanges(array $changes, array|string|null $attributes = null)

Determine if any of the given attributes were changed when the model was last saved.

Parameters

array $changes
array|string|null $attributes

Return Value

bool

array getDirty()

Get the attributes that have been changed since the last sync.

Return Value

array

protected array getDirtyForUpdate()

Get the attributes that have been changed since the last sync for an update operation.

Return Value

array

array getChanges()

Get the attributes that were changed when the model was last saved.

Return Value

array

bool originalIsEquivalent(string $key)

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

Parameters

string $key

Return Value

bool

protected mixed transformModelValue(string $key, mixed $value)

Transform a raw model value using mutators, casts, etc.

Parameters

string $key
mixed $value

Return Value

mixed

$this append(array|string $attributes)

Append attributes to query when building a query.

Parameters

array|string $attributes

Return Value

$this

array getAppends()

Get the accessors that are being appended to model arrays.

Return Value

array

$this setAppends(array $appends)

Set the accessors to append to model arrays.

Parameters

array $appends

Return Value

$this

bool hasAppended(string $attribute)

Return whether the accessor attribute has been appended.

Parameters

string $attribute

Return Value

bool

array getMutatedAttributes()

Get the mutated attributes for a given instance.

Return Value

array

static void cacheMutatedAttributes(object|string $classOrInstance)

Extract and cache all the mutated attributes of a class.

Parameters

object|string $classOrInstance

Return Value

void

static protected array getMutatorMethods(mixed $class)

Get all of the attribute mutator methods.

Parameters

mixed $class

Return Value

array

static protected array getAttributeMarkedMutatorMethods(mixed $class)

Get all of the "Attribute" return typed attribute mutator methods.

Parameters

mixed $class

Return Value

array

static void bootHasEvents()

Boot the has event trait for a model.

Return Value

void

static array resolveObserveAttributes()

Resolve the observe class names from the attributes.

Return Value

array

static void observe(object|array|string $classes)

Register observers with the model.

Parameters

object|array|string $classes

Return Value

void

Exceptions

RuntimeException

protected void registerObserver(object|string $class)

Register a single observer with the model.

Parameters

object|string $class

Return Value

void

Exceptions

RuntimeException

array getObservableEvents()

Get the observable event names.

Return Value

array

$this setObservableEvents(array $observables)

Set the observable event names.

Parameters

array $observables

Return Value

$this

void addObservableEvents(array|mixed $observables)

Add an observable event name.

Parameters

array|mixed $observables

Return Value

void

void removeObservableEvents(array|mixed $observables)

Remove an observable event name.

Parameters

array|mixed $observables

Return Value

void

static protected void registerModelEvent(string $event, QueuedClosure|callable|array|class-string $callback)

Register a model event with the dispatcher.

Parameters

string $event
QueuedClosure|callable|array|class-string $callback

Return Value

void

protected mixed fireModelEvent(string $event, bool $halt = true)

Fire the given event for the model.

Parameters

string $event
bool $halt

Return Value

mixed

protected mixed|null fireCustomModelEvent(string $event, string $method)

Fire a custom model event for the given event.

Parameters

string $event
string $method

Return Value

mixed|null

protected mixed filterModelEventResults(mixed $result)

Filter the model event results.

Parameters

mixed $result

Return Value

mixed

static void retrieved(QueuedClosure|callable|array|class-string $callback)

Register a retrieved model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void saving(QueuedClosure|callable|array|class-string $callback)

Register a saving model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void saved(QueuedClosure|callable|array|class-string $callback)

Register a saved model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void updating(QueuedClosure|callable|array|class-string $callback)

Register an updating model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void updated(QueuedClosure|callable|array|class-string $callback)

Register an updated model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void creating(QueuedClosure|callable|array|class-string $callback)

Register a creating model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void created(QueuedClosure|callable|array|class-string $callback)

Register a created model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void replicating(QueuedClosure|callable|array|class-string $callback)

Register a replicating model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void deleting(QueuedClosure|callable|array|class-string $callback)

Register a deleting model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void deleted(QueuedClosure|callable|array|class-string $callback)

Register a deleted model event with the dispatcher.

Parameters

QueuedClosure|callable|array|class-string $callback

Return Value

void

static void flushEventListeners()

Remove all the event listeners for the model.

Return Value

void

array dispatchesEvents()

Get the event map for the model.

Return Value

array

static Dispatcher|null getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher|null

static void setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void

static void unsetEventDispatcher()

Unset the event dispatcher for models.

Return Value

void

static mixed withoutEvents(callable $callback)

Execute a callback without firing any model events for any model type.

Parameters

callable $callback

Return Value

mixed

static void bootHasGlobalScopes()

Boot the has global scopes trait for a model.

Return Value

void

static array resolveGlobalScopeAttributes()

Resolve the global scope class names from the attributes.

Return Value

array

static mixed addGlobalScope(Scope|Closure|string $scope, Scope|Closure|null $implementation = null)

Register a new global scope on the model.

Parameters

Scope|Closure|string $scope
Scope|Closure|null $implementation

Return Value

mixed

Exceptions

InvalidArgumentException

static void addGlobalScopes(array $scopes)

Register multiple global scopes on the model.

Parameters

array $scopes

Return Value

void

static bool hasGlobalScope(Scope|string $scope)

Determine if a model has a global scope.

Parameters

Scope|string $scope

Return Value

bool

static Scope|Closure|null getGlobalScope(Scope|string $scope)

Get a global scope registered with the model.

Parameters

Scope|string $scope

Return Value

Scope|Closure|null

static array getAllGlobalScopes()

Get all of the global scopes that are currently registered.

Return Value

array

static void setAllGlobalScopes(array $scopes)

Set the current global scopes.

Parameters

array $scopes

Return Value

void

array getGlobalScopes()

Get the global scopes for this class instance.

Return Value

array

mixed relationResolver(string $class, string $key)

Get the dynamic relation resolver if defined or inherited, or return null.

Parameters

string $class
string $key

Return Value

mixed

static void resolveRelationUsing(string $name, Closure $callback)

Define a dynamic relation resolver.

Parameters

string $name
Closure $callback

Return Value

void

TRelatedModel,$this> hasOne(TRelatedModel> $related, string|null $foreignKey = null, string|null $localKey = null)

Define a one-to-one relationship.

Parameters

TRelatedModel> $related
string|null $foreignKey
string|null $localKey

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newHasOne(Builder $query, Model $parent, string $foreignKey, string $localKey)

Instantiate a new HasOne relationship.

Parameters

Builder $query
Model $parent
string $foreignKey
string $localKey

Return Value

TDeclaringModel>

hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)

No description

Parameters

$related
$through
$firstKey
$secondKey
$localKey
$secondLocalKey

protected newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey)

No description

Parameters

Builder $query
Model $farParent
Model $throughParent
$firstKey
$secondKey
$localKey
$secondLocalKey

TRelatedModel,$this> morphOne(TRelatedModel> $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null)

Define a polymorphic one-to-one relationship.

Parameters

TRelatedModel> $related
string $name
string|null $type
string|null $id
string|null $localKey

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newMorphOne(Builder $query, Model $parent, string $type, string $id, string $localKey)

Instantiate a new MorphOne relationship.

Parameters

Builder $query
Model $parent
string $type
string $id
string $localKey

Return Value

TDeclaringModel>

TRelatedModel,$this> belongsTo(TRelatedModel> $related, string|null $foreignKey = null, string|null $ownerKey = null, string|null $relation = null)

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

Parameters

TRelatedModel> $related
string|null $foreignKey
string|null $ownerKey
string|null $relation

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newBelongsTo(Builder $query, Model $child, string $foreignKey, string $ownerKey, string $relation)

Instantiate a new BelongsTo relationship.

Parameters

Builder $query
Model $child
string $foreignKey
string $ownerKey
string $relation

Return Value

TDeclaringModel>

Model,$this> morphTo(string|null $name = null, string|null $type = null, string|null $id = null, string|null $ownerKey = null)

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

Parameters

string|null $name
string|null $type
string|null $id
string|null $ownerKey

Return Value

Model,$this>

protected Model,$this> morphEagerTo(string $name, string $type, string $id, string|null $ownerKey)

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

Parameters

string $name
string $type
string $id
string|null $ownerKey

Return Value

Model,$this>

protected Model,$this> morphInstanceTo(string $target, string $name, string $type, string $id, string|null $ownerKey)

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

Parameters

string $target
string $name
string $type
string $id
string|null $ownerKey

Return Value

Model,$this>

protected TDeclaringModel> newMorphTo(Builder $query, Model $parent, string $foreignKey, string|null $ownerKey, string $type, string $relation)

Instantiate a new MorphTo relationship.

Parameters

Builder $query
Model $parent
string $foreignKey
string|null $ownerKey
string $type
string $relation

Return Value

TDeclaringModel>

static string getActualClassNameForMorph(string $class)

Retrieve the actual class name for a given morph class.

Parameters

string $class

Return Value

string

protected string guessBelongsToRelation()

Guess the "belongs to" relationship name.

Return Value

string

through($relationship)

Create a pending has-many-through or has-one-through relationship.

Parameters

$relationship

TRelatedModel,$this> hasMany(TRelatedModel> $related, string|null $foreignKey = null, string|null $localKey = null)

Define a one-to-many relationship.

Parameters

TRelatedModel> $related
string|null $foreignKey
string|null $localKey

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newHasMany(Builder $query, Model $parent, string $foreignKey, string $localKey)

Instantiate a new HasMany relationship.

Parameters

Builder $query
Model $parent
string $foreignKey
string $localKey

Return Value

TDeclaringModel>

hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)

No description

Parameters

$related
$through
$firstKey
$secondKey
$localKey
$secondLocalKey

protected newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey)

No description

Parameters

Builder $query
Model $farParent
Model $throughParent
$firstKey
$secondKey
$localKey
$secondLocalKey

TRelatedModel,$this> morphMany(TRelatedModel> $related, string $name, string|null $type = null, string|null $id = null, string|null $localKey = null)

Define a polymorphic one-to-many relationship.

Parameters

TRelatedModel> $related
string $name
string|null $type
string|null $id
string|null $localKey

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newMorphMany(Builder $query, Model $parent, string $type, string $id, string $localKey)

Instantiate a new MorphMany relationship.

Parameters

Builder $query
Model $parent
string $type
string $id
string $localKey

Return Value

TDeclaringModel>

TRelatedModel,$this> belongsToMany(TRelatedModel> $related, string|Model>|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null)

Define a many-to-many relationship.

Parameters

TRelatedModel> $related
string|Model>|null $table
string|null $foreignPivotKey
string|null $relatedPivotKey
string|null $parentKey
string|null $relatedKey
string|null $relation

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newBelongsToMany(Builder $query, Model $parent, string|Model> $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey, string|null $relationName = null)

Instantiate a new BelongsToMany relationship.

Parameters

Builder $query
Model $parent
string|Model> $table
string $foreignPivotKey
string $relatedPivotKey
string $parentKey
string $relatedKey
string|null $relationName

Return Value

TDeclaringModel>

TRelatedModel,$this> morphToMany(TRelatedModel> $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null, bool $inverse = false)

Define a polymorphic many-to-many relationship.

Parameters

TRelatedModel> $related
string $name
string|null $table
string|null $foreignPivotKey
string|null $relatedPivotKey
string|null $parentKey
string|null $relatedKey
string|null $relation
bool $inverse

Return Value

TRelatedModel,$this>

protected TDeclaringModel> newMorphToMany(Builder $query, Model $parent, string $name, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey, string|null $relationName = null, bool $inverse = false)

Instantiate a new MorphToMany relationship.

Parameters

Builder $query
Model $parent
string $name
string $table
string $foreignPivotKey
string $relatedPivotKey
string $parentKey
string $relatedKey
string|null $relationName
bool $inverse

Return Value

TDeclaringModel>

TRelatedModel,$this> morphedByMany(TRelatedModel> $related, string $name, string|null $table = null, string|null $foreignPivotKey = null, string|null $relatedPivotKey = null, string|null $parentKey = null, string|null $relatedKey = null, string|null $relation = null)

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

Parameters

TRelatedModel> $related
string $name
string|null $table
string|null $foreignPivotKey
string|null $relatedPivotKey
string|null $parentKey
string|null $relatedKey
string|null $relation

Return Value

TRelatedModel,$this>

protected string|null guessBelongsToManyRelation()

Get the relationship name of the belongsToMany relationship.

Return Value

string|null

string joiningTable(string $related, Model|null $instance = null)

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

Parameters

string $related
Model|null $instance

Return Value

string

string joiningTableSegment()

Get this model's half of the intermediate table name for belongsToMany relationships.

Return Value

string

bool touches(string $relation)

Determine if the model touches a given relation.

Parameters

string $relation

Return Value

bool

void touchOwners()

Touch the owning relations of the model.

Return Value

void

protected array getMorphs(string $name, string $type, string $id)

Get the polymorphic relationship columns.

Parameters

string $name
string $type
string $id

Return Value

array

string getMorphClass()

Get the class name for polymorphic relations.

Return Value

string

protected mixed newRelatedInstance(string $class)

Create a new model instance for a related model.

Parameters

string $class

Return Value

mixed

protected mixed newRelatedThroughInstance(string $class)

Create a new model instance for a related "through" model.

Parameters

string $class

Return Value

mixed

array getRelations()

Get all the loaded relations for the instance.

Return Value

array

mixed getRelation(string $relation)

Get a specified relationship.

Parameters

string $relation

Return Value

mixed

bool relationLoaded(string $key)

Determine if the given relation is loaded.

Parameters

string $key

Return Value

bool

$this setRelation(string $relation, mixed $value)

Set the given relationship on the model.

Parameters

string $relation
mixed $value

Return Value

$this

$this unsetRelation(string $relation)

Unset a loaded relationship.

Parameters

string $relation

Return Value

$this

$this setRelations(array $relations)

Set the entire relations array on the model.

Parameters

array $relations

Return Value

$this

$this withoutRelations()

Duplicate the instance and unset all the loaded relations.

Return Value

$this

$this unsetRelations()

Unset all the loaded relations for the instance.

Return Value

$this

array getTouchedRelations()

Get the relationships that are touched on save.

Return Value

array

$this setTouchedRelations(array $touches)

Set the relationships that are touched on save.

Parameters

array $touches

Return Value

$this

bool touch(string|null $attribute = null)

Update the model's update timestamp.

Parameters

string|null $attribute

Return Value

bool

bool touchQuietly(string|null $attribute = null)

Update the model's update timestamp without raising any events.

Parameters

string|null $attribute

Return Value

bool

$this updateTimestamps()

Update the creation and update timestamps.

Return Value

$this

$this setCreatedAt(mixed $value)

Set the value of the "created at" attribute.

Parameters

mixed $value

Return Value

$this

$this setUpdatedAt(mixed $value)

Set the value of the "updated at" attribute.

Parameters

mixed $value

Return Value

$this

Carbon freshTimestamp()

Get a fresh timestamp for the model.

Return Value

Carbon

string freshTimestampString()

Get a fresh timestamp for the model.

Return Value

string

bool usesTimestamps()

Determine if the model uses timestamps.

Return Value

bool

string|null getCreatedAtColumn()

Get the name of the "created at" column.

Return Value

string|null

string|null getUpdatedAtColumn()

Get the name of the "updated at" column.

Return Value

string|null

string|null getQualifiedCreatedAtColumn()

Get the fully qualified "created at" column.

Return Value

string|null

string|null getQualifiedUpdatedAtColumn()

Get the fully qualified "updated at" column.

Return Value

string|null

static mixed withoutTimestamps(callable $callback)

Disable timestamps for the current class during the given callback scope.

Parameters

callable $callback

Return Value

mixed

static mixed withoutTimestampsOn(array $models, callable $callback)

Disable timestamps for the given model classes during the given callback scope.

Parameters

array $models
callable $callback

Return Value

mixed

static bool isIgnoringTimestamps(string|null $class = null)

Determine if the given model is ignoring timestamps / touches.

Parameters

string|null $class

Return Value

bool

bool usesUniqueIds()

Determine if the model uses unique ids.

Return Value

bool

void setUniqueIds()

Generate unique keys for the model.

Return Value

void

string newUniqueId()

Generate a new key for the model.

Return Value

string

array uniqueIds()

Get the columns that should receive a unique identifier.

Return Value

array

string[] getHidden()

Get the hidden attributes for the model.

Return Value

string[]

$this setHidden(array $hidden)

Set the hidden attributes for the model.

Parameters

array $hidden

Return Value

$this

string[] getVisible()

Get the visible attributes for the model.

Return Value

string[]

$this setVisible(array $visible)

Set the visible attributes for the model.

Parameters

array $visible

Return Value

$this

$this makeVisible(string[]|string|null $attributes)

Make the given, typically hidden, attributes visible.

Parameters

string[]|string|null $attributes

Return Value

$this

$this makeVisibleIf(bool|Closure $condition, string[]|string|null $attributes)

Make the given, typically hidden, attributes visible if the given truth test passes.

Parameters

bool|Closure $condition
string[]|string|null $attributes

Return Value

$this

$this makeHidden(string[]|string|null $attributes)

Make the given, typically visible, attributes hidden.

Parameters

string[]|string|null $attributes

Return Value

$this

$this makeHiddenIf(bool|Closure $condition, string[]|string|null $attributes)

Make the given, typically visible, attributes hidden if the given truth test passes.

Parameters

bool|Closure $condition
string[]|string|null $attributes

Return Value

$this

string[] getFillable()

Get the fillable attributes for the model.

Return Value

string[]

$this fillable(array $fillable)

Set the fillable attributes for the model.

Parameters

array $fillable

Return Value

$this

$this mergeFillable(array $fillable)

Merge new fillable attributes with existing fillable attributes on the model.

Parameters

array $fillable

Return Value

$this

string[] getGuarded()

Get the guarded attributes for the model.

Return Value

string[]

$this guard(array $guarded)

Set the guarded attributes for the model.

Parameters

array $guarded

Return Value

$this

$this mergeGuarded(array $guarded)

Merge new guarded attributes with existing guarded attributes on the model.

Parameters

array $guarded

Return Value

$this

static void unguard(bool $state = true)

Disable all mass assignable restrictions.

Parameters

bool $state

Return Value

void

static void reguard()

Enable the mass assignment restrictions.

Return Value

void

static bool isUnguarded()

Determine if the current state is "unguarded".

Return Value

bool

static mixed unguarded(callable $callback)

Run the given callable while being unguarded.

Parameters

callable $callback

Return Value

mixed

bool isFillable(string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key

Return Value

bool

bool isGuarded(string $key)

Determine if the given key is guarded.

Parameters

string $key

Return Value

bool

protected bool isGuardableColumn(string $key)

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

Parameters

string $key

Return Value

bool

bool totallyGuarded()

Determine if the model is totally guarded.

Return Value

bool

protected array fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

Parameters

array $attributes

Return Value

array

protected mixed withoutRecursion(callable $callback, mixed $default = null)

Prevent a method from being called multiple times on the same object within the same call stack.

Parameters

callable $callback
mixed $default

Return Value

mixed

static protected clearRecursiveCallValue(object $object, string $hash)

Remove an entry from the recursion cache for an object.

Parameters

object $object
string $hash

static protected array getRecursiveCallStack(object $object)

Get the stack of methods being called recursively for the current object.

Parameters

object $object

Return Value

array

static protected WeakMap getRecursionCache()

Get the current recursion cache being used by the model.

Return Value

WeakMap

static protected mixed setRecursiveCallValue(object $object, string $hash, mixed $value)

Set a value in the recursion cache for the given object and method.

Parameters

object $object
string $hash
mixed $value

Return Value

mixed

protected mixed forwardCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

protected mixed forwardDecoratedCallTo(mixed $object, string $method, array $parameters)

Forward a method call to the given object, returning $this if the forwarded call returned itself.

Parameters

mixed $object
string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

static protected never throwBadMethodCallException(string $method)

Throw a bad method call exception for the given method.

Parameters

string $method

Return Value

never

Exceptions

BadMethodCallException

TCollection newCollection(array $models = [])

Create a new Eloquent Collection instance.

Parameters

array $models

Return Value

TCollection

TCollection>|null resolveCollectionFromAttribute()

Resolve the collection class name from the CollectedBy attribute.

Return Value

TCollection>|null

void __construct(array $attributes = [])

Create a new Eloquent model instance.

Parameters

array $attributes

Return Value

void

protected void bootIfNotBooted()

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

Return Value

void

static protected void booting()

Perform any actions required before the model boots.

Return Value

void

static protected void boot()

Bootstrap the model and its traits.

Return Value

void

static protected void bootTraits()

Boot all of the bootable traits on the model.

Return Value

void

protected void initializeTraits()

Initialize any initializable traits on the model.

Return Value

void

static protected void booted()

Perform any actions required after the model boots.

Return Value

void

static void clearBootedModels()

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

Return Value

void

static void withoutTouching(callable $callback)

Disables relationship model touching for the current class during given callback scope.

Parameters

callable $callback

Return Value

void

static void withoutTouchingOn(array $models, callable $callback)

Disables relationship model touching for the given model classes during given callback scope.

Parameters

array $models
callable $callback

Return Value

void

static bool isIgnoringTouch(string|null $class = null)

Determine if the given model is ignoring touches.

Parameters

string|null $class

Return Value

bool

static void shouldBeStrict(bool $shouldBeStrict = true)

Indicate that models should prevent lazy loading, silently discarding attributes, and accessing missing attributes.

Parameters

bool $shouldBeStrict

Return Value

void

static void preventLazyLoading(bool $value = true)

Prevent model relationships from being lazy loaded.

Parameters

bool $value

Return Value

void

static void handleLazyLoadingViolationUsing(callable|null $callback)

Register a callback that is responsible for handling lazy loading violations.

Parameters

callable|null $callback

Return Value

void

static void preventSilentlyDiscardingAttributes(bool $value = true)

Prevent non-fillable attributes from being silently discarded.

Parameters

bool $value

Return Value

void

static void handleDiscardedAttributeViolationUsing(callable|null $callback)

Register a callback that is responsible for handling discarded attribute violations.

Parameters

callable|null $callback

Return Value

void

static void preventAccessingMissingAttributes(bool $value = true)

Prevent accessing missing attributes on retrieved models.

Parameters

bool $value

Return Value

void

static void handleMissingAttributeViolationUsing(callable|null $callback)

Register a callback that is responsible for handling missing attribute violations.

Parameters

callable|null $callback

Return Value

void

static mixed withoutBroadcasting(callable $callback)

Execute a callback without broadcasting any model events for all model types.

Parameters

callable $callback

Return Value

mixed

$this fill(array $attributes)

Fill the model with an array of attributes.

Parameters

array $attributes

Return Value

$this

Exceptions

MassAssignmentException

$this forceFill(array $attributes)

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

Parameters

array $attributes

Return Value

$this

string qualifyColumn(string $column)

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

Parameters

string $column

Return Value

string

array qualifyColumns(array $columns)

Qualify the given columns with the model's table.

Parameters

array $columns

Return Value

array

Model newInstance(array $attributes = [], bool $exists = false)

Create a new instance of the given model.

Parameters

array $attributes
bool $exists

Return Value

Model

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

Create a new model instance that is existing.

Parameters

array $attributes
string|null $connection

Return Value

Model

static Builder<static> on(string|null $connection = null)

Begin querying the model on a given connection.

Parameters

string|null $connection

Return Value

Builder<static>

static Builder<static> onWriteConnection()

Begin querying the model on the write connection.

Return Value

Builder<static>

static Collection<int,static> all(array|string $columns = ['*'])

Get all of the models from the database.

Parameters

array|string $columns

Return Value

Collection<int,static>

static Builder<static> with(array|string $relations)

Begin querying a model with eager loading.

Parameters

array|string $relations

Return Value

Builder<static>

$this load(array|string $relations)

Eager load relations on the model.

Parameters

array|string $relations

Return Value

$this

$this loadMorph(string $relation, array $relations)

Eager load relationships on the polymorphic relation of a model.

Parameters

string $relation
array $relations

Return Value

$this

$this loadMissing(array|string $relations)

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

Parameters

array|string $relations

Return Value

$this

$this loadAggregate(array|string $relations, string $column, string|null $function = null)

Eager load relation's column aggregations on the model.

Parameters

array|string $relations
string $column
string|null $function

Return Value

$this

$this loadCount(array|string $relations)

Eager load relation counts on the model.

Parameters

array|string $relations

Return Value

$this

$this loadMax(array|string $relations, string $column)

Eager load relation max column values on the model.

Parameters

array|string $relations
string $column

Return Value

$this

$this loadMin(array|string $relations, string $column)

Eager load relation min column values on the model.

Parameters

array|string $relations
string $column

Return Value

$this

$this loadSum(array|string $relations, string $column)

Eager load relation's column summations on the model.

Parameters

array|string $relations
string $column

Return Value

$this

$this loadAvg(array|string $relations, string $column)

Eager load relation average column values on the model.

Parameters

array|string $relations
string $column

Return Value

$this

$this loadExists(array|string $relations)

Eager load related model existence values on the model.

Parameters

array|string $relations

Return Value

$this

$this loadMorphAggregate(string $relation, array $relations, string $column, string|null $function = null)

Eager load relationship column aggregation on the polymorphic relation of a model.

Parameters

string $relation
array $relations
string $column
string|null $function

Return Value

$this

$this loadMorphCount(string $relation, array $relations)

Eager load relationship counts on the polymorphic relation of a model.

Parameters

string $relation
array $relations

Return Value

$this

$this loadMorphMax(string $relation, array $relations, string $column)

Eager load relationship max column values on the polymorphic relation of a model.

Parameters

string $relation
array $relations
string $column

Return Value

$this

$this loadMorphMin(string $relation, array $relations, string $column)

Eager load relationship min column values on the polymorphic relation of a model.

Parameters

string $relation
array $relations
string $column

Return Value

$this

$this loadMorphSum(string $relation, array $relations, string $column)

Eager load relationship column summations on the polymorphic relation of a model.

Parameters

string $relation
array $relations
string $column

Return Value

$this

$this loadMorphAvg(string $relation, array $relations, string $column)

Eager load relationship average column values on the polymorphic relation of a model.

Parameters

string $relation
array $relations
string $column

Return Value

$this

protected int increment(string $column, float|int $amount = 1, array $extra = [])

Increment a column's value by a given amount.

Parameters

string $column
float|int $amount
array $extra

Return Value

int

protected int decrement(string $column, float|int $amount = 1, array $extra = [])

Decrement a column's value by a given amount.

Parameters

string $column
float|int $amount
array $extra

Return Value

int

protected int incrementOrDecrement(string $column, float|int $amount, array $extra, string $method)

Run the increment or decrement method on the model.

Parameters

string $column
float|int $amount
array $extra
string $method

Return Value

int

bool update(array $attributes = [], array $options = [])

Update the model in the database.

Parameters

array $attributes
array $options

Return Value

bool

bool updateOrFail(array $attributes = [], array $options = [])

Update the model in the database within a transaction.

Parameters

array $attributes
array $options

Return Value

bool

Exceptions

Throwable

bool updateQuietly(array $attributes = [], array $options = [])

Update the model in the database without raising any events.

Parameters

array $attributes
array $options

Return Value

bool

protected int incrementQuietly(string $column, float|int $amount = 1, array $extra = [])

Increment a column's value by a given amount without raising any events.

Parameters

string $column
float|int $amount
array $extra

Return Value

int

protected int decrementQuietly(string $column, float|int $amount = 1, array $extra = [])

Decrement a column's value by a given amount without raising any events.

Parameters

string $column
float|int $amount
array $extra

Return Value

int

bool push()

Save the model and all of its relationships.

Return Value

bool

bool pushQuietly()

Save the model and all of its relationships without raising any events to the parent model.

Return Value

bool

bool saveQuietly(array $options = [])

Save the model to the database without raising any events.

Parameters

array $options

Return Value

bool

bool save(array $options = [])

Save the model to the database.

Parameters

array $options

Return Value

bool

bool saveOrFail(array $options = [])

Save the model to the database within a transaction.

Parameters

array $options

Return Value

bool

Exceptions

Throwable

protected void finishSave(array $options)

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

Parameters

array $options

Return Value

void

protected bool performUpdate(Builder $query)

Perform a model update operation.

Parameters

Builder $query

Return Value

bool

protected Builder<static> setKeysForSelectQuery(Builder<static> $query)

Set the keys for a select query.

Parameters

Builder<static> $query

Return Value

Builder<static>

protected mixed getKeyForSelectQuery()

Get the primary key value for a select query.

Return Value

mixed

protected Builder<static> setKeysForSaveQuery(Builder<static> $query)

Set the keys for a save update query.

Parameters

Builder<static> $query

Return Value

Builder<static>

protected mixed getKeyForSaveQuery()

Get the primary key value for a save query.

Return Value

mixed

protected bool performInsert(Builder $query)

Perform a model insert operation.

Parameters

Builder $query

Return Value

bool

protected void insertAndSetId(Builder $query, array $attributes)

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

Parameters

Builder $query
array $attributes

Return Value

void

static int destroy(Collection|array|int|string $ids)

Destroy the models for the given IDs.

Parameters

Collection|array|int|string $ids

Return Value

int

bool|null delete()

Delete the model from the database.

Return Value

bool|null

Exceptions

LogicException

bool deleteQuietly()

Delete the model from the database without raising any events.

Return Value

bool

bool|null deleteOrFail()

Delete the model from the database within a transaction.

Return Value

bool|null

Exceptions

Throwable

bool|null forceDelete()

Force a hard delete on a soft deleted model.

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

Return Value

bool|null

static bool|null forceDestroy(Collection|array|int|string $ids)

Force a hard destroy on a soft deleted model.

This method protects developers from running forceDestroy when the trait is missing.

Parameters

Collection|array|int|string $ids

Return Value

bool|null

protected void performDeleteOnModel()

Perform the actual delete query on this model instance.

Return Value

void

static Builder<static> query()

Begin querying the model.

Return Value

Builder<static>

Builder<static> newQuery()

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

Return Value

Builder<static>

Builder<static> newModelQuery()

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

Return Value

Builder<static>

Builder<static> newQueryWithoutRelationships()

Get a new query builder with no relationships loaded.

Return Value

Builder<static>

Builder<static> registerGlobalScopes(Builder<static> $builder)

Register the global scopes for this builder instance.

Parameters

Builder<static> $builder

Return Value

Builder<static>

Builder<static> newQueryWithoutScopes()

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

Return Value

Builder<static>

Builder<static> newQueryWithoutScope(Scope|string $scope)

Get a new query instance without a given scope.

Parameters

Scope|string $scope

Return Value

Builder<static>

Builder<static> newQueryForRestoration(array|int $ids)

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

Parameters

array|int $ids

Return Value

Builder<static>

newEloquentBuilder(Builder $query)

Create a new Eloquent query builder for the model.

Parameters

Builder $query

protected Builder newBaseQueryBuilder()

Get a new query builder instance for the connection.

Return Value

Builder

Pivot newPivot(Model $parent, array $attributes, string $table, bool $exists, string|null $using = null)

Create a new pivot model instance.

Parameters

Model $parent
array $attributes
string $table
bool $exists
string|null $using

Return Value

Pivot

bool hasNamedScope(string $scope)

Determine if the model has a given scope.

Parameters

string $scope

Return Value

bool

mixed callNamedScope(string $scope, array $parameters = [])

Apply the given named scope if possible.

Parameters

string $scope
array $parameters

Return Value

mixed

toArray()

Convert the model instance to an array.

string toJson(int $options = 0)

Convert the model instance to JSON.

Parameters

int $options

Return Value

string

Exceptions

JsonEncodingException

mixed jsonSerialize()

Convert the object into something JSON serializable.

Return Value

mixed

Model|null fresh(array|string $with = [])

Reload a fresh model instance from the database.

Parameters

array|string $with

Return Value

Model|null

$this refresh()

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

Return Value

$this

Model replicate(array|null $except = null)

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

Parameters

array|null $except

Return Value

Model

Model replicateQuietly(array|null $except = null)

Clone the model into a new, non-existing instance without raising any events.

Parameters

array|null $except

Return Value

Model

bool is(Model|null $model)

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

Parameters

Model|null $model

Return Value

bool

bool isNot(Model|null $model)

Determine if two models are not the same.

Parameters

Model|null $model

Return Value

bool

Connection getConnection()

Get the database connection for the model.

Return Value

Connection

string|null getConnectionName()

Get the current connection name for the model.

Return Value

string|null

$this setConnection(string|null $name)

Set the connection associated with the model.

Parameters

string|null $name

Return Value

$this

static Connection resolveConnection(string|null $connection = null)

Resolve a connection instance.

Parameters

string|null $connection

Return Value

Connection

static ConnectionResolverInterface|null getConnectionResolver()

Get the connection resolver instance.

Return Value

ConnectionResolverInterface|null

static void setConnectionResolver(ConnectionResolverInterface $resolver)

Set the connection resolver instance.

Parameters

ConnectionResolverInterface $resolver

Return Value

void

static void unsetConnectionResolver()

Unset the connection resolver for models.

Return Value

void

string getTable()

Get the table associated with the model.

Return Value

string

$this setTable(string $table)

Set the table associated with the model.

Parameters

string $table

Return Value

$this

string getKeyName()

Get the primary key for the model.

Return Value

string

$this setKeyName(string $key)

Set the primary key for the model.

Parameters

string $key

Return Value

$this

string getQualifiedKeyName()

Get the table qualified key name.

Return Value

string

string getKeyType()

Get the auto-incrementing key type.

Return Value

string

$this setKeyType(string $type)

Set the data type for the primary key.

Parameters

string $type

Return Value

$this

bool getIncrementing()

Get the value indicating whether the IDs are incrementing.

Return Value

bool

$this setIncrementing(bool $value)

Set whether IDs are incrementing.

Parameters

bool $value

Return Value

$this

mixed getKey()

Get the value of the model's primary key.

Return Value

mixed

mixed getQueueableId()

Get the queueable identity for the entity.

Return Value

mixed

array getQueueableRelations()

Get the queueable relationships for the entity.

Return Value

array

string|null getQueueableConnection()

Get the queueable connection for the entity.

Return Value

string|null

mixed getRouteKey()

Get the value of the model's route key.

Return Value

mixed

string getRouteKeyName()

Get the route key for the model.

Return Value

string

Model|null resolveRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Parameters

mixed $value
string|null $field

Return Value

Model|null

Model|null resolveSoftDeletableRouteBinding(mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Parameters

mixed $value
string|null $field

Return Value

Model|null

Model|null resolveChildRouteBinding(string $childType, mixed $value, string|null $field)

Retrieve the child model for a bound value.

Parameters

string $childType
mixed $value
string|null $field

Return Value

Model|null

Model|null resolveSoftDeletableChildRouteBinding(string $childType, mixed $value, string|null $field)

Retrieve the child model for a bound value.

Parameters

string $childType
mixed $value
string|null $field

Return Value

Model|null

protected resolveChildRouteBindingQuery($childType, $value, $field)

No description

Parameters

$childType
$value
$field

protected string childRouteBindingRelationshipName(string $childType)

Retrieve the child route model binding relationship name for the given child type.

Parameters

string $childType

Return Value

string

Builder resolveRouteBindingQuery(Model|Builder|Relation $query, mixed $value, string|null $field = null)

Retrieve the model for a bound value.

Parameters

Model|Builder|Relation $query
mixed $value
string|null $field

Return Value

Builder

string getForeignKey()

Get the default foreign key name for the model.

Return Value

string

int getPerPage()

Get the number of models to return per page.

Return Value

int

$this setPerPage(int $perPage)

Set the number of models to return per page.

Parameters

int $perPage

Return Value

$this

static bool preventsLazyLoading()

Determine if lazy loading is disabled.

Return Value

bool

static bool preventsSilentlyDiscardingAttributes()

Determine if discarding guarded attribute fills is disabled.

Return Value

bool

static bool preventsAccessingMissingAttributes()

Determine if accessing missing attributes is disabled.

Return Value

bool

string broadcastChannelRoute()

Get the broadcast channel route definition that is associated with the given entity.

Return Value

string

string broadcastChannel()

Get the broadcast channel name that is associated with the given entity.

Return Value

string

mixed __get(string $key)

Dynamically retrieve attributes on the model.

Parameters

string $key

Return Value

mixed

void __set(string $key, mixed $value)

Dynamically set attributes on the model.

Parameters

string $key
mixed $value

Return Value

void

bool offsetExists(mixed $offset)

Determine if the given attribute exists.

Parameters

mixed $offset

Return Value

bool

mixed offsetGet(mixed $offset)

Get the value for a given offset.

Parameters

mixed $offset

Return Value

mixed

void offsetSet(mixed $offset, mixed $value)

Set the value for a given offset.

Parameters

mixed $offset
mixed $value

Return Value

void

void offsetUnset(mixed $offset)

Unset the value for a given offset.

Parameters

mixed $offset

Return Value

void

bool __isset(string $key)

Determine if an attribute or relation exists on the model.

Parameters

string $key

Return Value

bool

void __unset(string $key)

Unset an attribute on the model.

Parameters

string $key

Return Value

void

mixed __call(string $method, array $parameters)

Handle dynamic method calls into the model.

Parameters

string $method
array $parameters

Return Value

mixed

static mixed __callStatic(string $method, array $parameters)

Handle dynamic static method calls into the model.

Parameters

string $method
array $parameters

Return Value

mixed

string __toString()

Convert the model to its string representation.

Return Value

string

$this escapeWhenCastingToString(bool $escape = true)

Indicate that the object's string representation should be escaped when __toString is invoked.

Parameters

bool $escape

Return Value

$this

array __sleep()

Prepare the object for serialization.

Return Value

array

void __wakeup()

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

Return Value

void

Model,$this> notifiable()

Get the notifiable entity that the notification belongs to.

Return Value

Model,$this>

void markAsRead()

Mark the notification as read.

Return Value

void

void markAsUnread()

Mark the notification as unread.

Return Value

void

bool read()

Determine if a notification has been read.

Return Value

bool

bool unread()

Determine if a notification has not been read.

Return Value

bool

Builder<static> scopeRead(Builder $query)

Scope a query to only include read notifications.

Parameters

Builder $query

Return Value

Builder<static>

Builder<static> scopeUnread(Builder $query)

Scope a query to only include unread notifications.

Parameters

Builder $query

Return Value

Builder<static>