Model
extends Model
in package
Table of Contents
Constants
- CREATED_AT = 'created_at'
- The name of the "created at" column.
- UPDATED_AT = 'updated_at'
- The name of the "updated at" column.
Properties
- $encrypter : Encrypter
- The encrypter instance that is used to encrypt attributes.
- $exists : bool
- Indicates if the model exists.
- $incrementing : bool
- Indicates if the IDs are auto-incrementing.
- $manyMethods : array<string|int, string>
- The many to many relationship methods.
- $preventsLazyLoading : bool
- Indicates whether lazy loading will be prevented on this model.
- $snakeAttributes : bool
- Indicates whether attributes are snake cased on arrays.
- $timestamps : bool
- Indicates if the model should be timestamped.
- $wasRecentlyCreated : bool
- Indicates if the model was inserted during the current request lifecycle.
- $appends : array<string|int, mixed>
- The accessors to append to the model's array form.
- $attributeCastCache : array<string|int, mixed>
- The attributes that have been cast using "Attribute" return type mutators.
- $attributeMutatorCache : array<string|int, mixed>
- The cache of the "Attribute" return type marked mutated attributes for each class.
- $attributes : array<string|int, mixed>
- The model's attributes.
- $booted : array<string|int, mixed>
- The array of booted models.
- $casts : array<string|int, mixed>
- The attributes that should be cast.
- $changes : array<string|int, mixed>
- The changed model attributes.
- $classCastCache : array<string|int, mixed>
- The attributes that have been cast using custom classes.
- $connection : string|null
- The connection name for the model.
- $dateFormat : string
- The storage format of the model's date columns.
- $dates : array<string|int, mixed>
- The attributes that should be mutated to dates.
- $dispatcher : Dispatcher
- The event dispatcher instance.
- $dispatchesEvents : array<string|int, mixed>
- The event map for the model.
- $escapeWhenCastingToString : bool
- Indicates that the object's string representation should be escaped when __toString is invoked.
- $fillable : array<string|int, string>
- The attributes that are mass assignable.
- $getAttributeMutatorCache : array<string|int, mixed>
- The cache of the "Attribute" return type marked mutated, gettable attributes for each class.
- $globalScopes : array<string|int, mixed>
- The array of global scopes on the model.
- $guardableColumns : array<string|int, mixed>
- The actual columns that exist on the database and can be guarded.
- $guarded : array<string|int, string>|bool
- The attributes that aren't mass assignable.
- $hidden : array<string|int, mixed>
- The attributes that should be hidden for serialization.
- $ignoreOnTouch : array<string|int, mixed>
- The list of models classes that should not be affected with touch.
- $isBroadcasting : bool
- Indicates if broadcasting is currently enabled.
- $keyType : string
- The "type" of the primary key ID.
- $lazyLoadingViolationCallback : callable|null
- The callback that is responsible for handling lazy loading violations.
- $modelsShouldPreventLazyLoading : bool
- Indicates whether lazy loading should be restricted on all models.
- $mutatorCache : array<string|int, mixed>
- The cache of the mutated attributes for each class.
- $observables : array<string|int, mixed>
- User exposed observable events.
- $original : array<string|int, mixed>
- The model attribute's original state.
- $perPage : int
- The number of models to return for pagination.
- $primaryKey : string
- The primary key for the model.
- $primitiveCastTypes : array<string|int, string>
- The built-in, primitive cast types supported by Eloquent.
- $relationResolvers : array<string|int, mixed>
- The relation resolver callbacks.
- $relations : array<string|int, mixed>
- The loaded relationships for the model.
- $resolver : ConnectionResolverInterface
- The connection resolver instance.
- $setAttributeMutatorCache : array<string|int, mixed>
- The cache of the "Attribute" return type marked mutated, settable attributes for each class.
- $table : string
- The table associated with the model.
- $touches : array<string|int, mixed>
- The relationships that should be touched on save.
- $traitInitializers : array<string|int, mixed>
- The array of trait initializers that will be called on each new instance.
- $unguarded : bool
- Indicates if all mass assignment is enabled.
- $visible : array<string|int, mixed>
- The attributes that should be visible in serialization.
- $with : array<string|int, mixed>
- The relations to eager load on every query.
- $withCount : array<string|int, mixed>
- The relationship counts that should be eager loaded on every query.
Methods
- __call() : mixed
- Handle dynamic method calls into the model.
- __callStatic() : mixed
- Handle dynamic static method calls into the model.
- __construct() : void
- Create a new Eloquent model instance.
- __get() : mixed
- Dynamically retrieve attributes on the model.
- __isset() : bool
- Determine if an attribute or relation exists on the model.
- __set() : void
- Dynamically set attributes on the model.
- __sleep() : array<string|int, mixed>
- Prepare the object for serialization.
- __toString() : string
- Convert the model to its string representation.
- __unset() : void
- Unset an attribute on the model.
- __wakeup() : void
- When a model is being unserialized, check if it needs to be booted.
- addGlobalScope() : mixed
- Register a new global scope on the model.
- addObservableEvents() : void
- Add an observable event name.
- all() : Collection|array<string|int, static>
- Get all of the models from the database.
- append() : $this
- Append attributes to query when building a query.
- attributesToArray() : array<string|int, mixed>
- Convert the model's attributes to an array.
- belongsTo() : BelongsTo
- Define an inverse one-to-one or many relationship.
- belongsToMany() : BelongsToMany
- Define a many-to-many relationship.
- broadcastChannel() : string
- Get the broadcast channel name that is associated with the given entity.
- broadcastChannelRoute() : string
- Get the broadcast channel route definition that is associated with the given entity.
- cacheMutatedAttributes() : void
- Extract and cache all the mutated attributes of a class.
- callNamedScope() : mixed
- Apply the given named scope if possible.
- clearBootedModels() : void
- Clear the list of booted models so they will be re-booted.
- created() : void
- Register a created model event with the dispatcher.
- creating() : void
- Register a creating model event with the dispatcher.
- delete() : bool|null
- Delete the model from the database.
- deleted() : void
- Register a deleted model event with the dispatcher.
- deleteOrFail() : bool|null
- Delete the model from the database within a transaction.
- deleting() : void
- Register a deleting model event with the dispatcher.
- destroy() : int
- Destroy the models for the given IDs.
- encryptUsing() : void
- Set the encrypter instance that will be used to encrypt attributes.
- escapeWhenCastingToString() : $this
- Indicate that the object's string representation should be escaped when __toString is invoked.
- fill() : $this
- Fill the model with an array of attributes.
- fillable() : $this
- Set the fillable attributes for the model.
- fillJsonAttribute() : $this
- Set a given JSON attribute on the model.
- flushEventListeners() : void
- Remove all of the event listeners for the model.
- forceDelete() : bool|null
- Force a hard delete on a soft deleted model.
- forceFill() : $this
- Fill the model with an array of attributes. Force mass assignment.
- fresh() : static|null
- Reload a fresh model instance from the database.
- freshTimestamp() : Carbon
- Get a fresh timestamp for the model.
- freshTimestampString() : string
- Get a fresh timestamp for the model.
- fromDateTime() : string|null
- Convert a DateTime to a storable string.
- fromEncryptedString() : mixed
- Decrypt the given encrypted string.
- fromFloat() : mixed
- Decode the given float.
- fromJson() : mixed
- Decode the given JSON back into an array or object.
- getActualClassNameForMorph() : string
- Retrieve the actual class name for a given morph class.
- getAttribute() : mixed
- Get an attribute from the model.
- getAttributes() : array<string|int, mixed>
- Get all of the current attributes on the model.
- getAttributeValue() : mixed
- Get a plain attribute (not a relationship).
- getCasts() : array<string|int, mixed>
- Get the casts array.
- getChanges() : array<string|int, mixed>
- Get the attributes that were changed.
- getConnection() : Connection
- Get the database connection for the model.
- getConnectionName() : string|null
- Get the current connection name for the model.
- getConnectionResolver() : ConnectionResolverInterface
- Get the connection resolver instance.
- getCreatedAtColumn() : string|null
- Get the name of the "created at" column.
- getDateFormat() : string
- Get the format for database stored dates.
- getDates() : array<string|int, mixed>
- Get the attributes that should be converted to dates.
- getDirty() : array<string|int, mixed>
- Get the attributes that have been changed since the last sync.
- getEventDispatcher() : Dispatcher
- Get the event dispatcher instance.
- getFillable() : array<string|int, mixed>
- Get the fillable attributes for the model.
- getForeignKey() : string
- Get the default foreign key name for the model.
- getGlobalScope() : Scope|Closure|null
- Get a global scope registered with the model.
- getGlobalScopes() : array<string|int, mixed>
- Get the global scopes for this class instance.
- getGuarded() : array<string|int, mixed>
- Get the guarded attributes for the model.
- getHidden() : array<string|int, mixed>
- Get the hidden attributes for the model.
- getIncrementing() : bool
- Get the value indicating whether the IDs are incrementing.
- getKey() : mixed
- Get the value of the model's primary key.
- getKeyName() : string
- Get the primary key for the model.
- getKeyType() : string
- Get the auto-incrementing key type.
- getMorphClass() : string
- Get the class name for polymorphic relations.
- getMutatedAttributes() : array<string|int, mixed>
- Get the mutated attributes for a given instance.
- getObservableEvents() : array<string|int, mixed>
- Get the observable event names.
- getOriginal() : mixed|array<string|int, mixed>
- Get the model's original attribute values.
- getPerPage() : int
- Get the number of models to return per page.
- getQualifiedCreatedAtColumn() : string|null
- Get the fully qualified "created at" column.
- getQualifiedKeyName() : string
- Get the table qualified key name.
- getQualifiedUpdatedAtColumn() : string|null
- Get the fully qualified "updated at" column.
- getQueueableConnection() : string|null
- Get the queueable connection for the entity.
- getQueueableId() : mixed
- Get the queueable identity for the entity.
- getQueueableRelations() : array<string|int, mixed>
- Get the queueable relationships for the entity.
- getRawOriginal() : mixed|array<string|int, mixed>
- Get the model's raw original attribute values.
- getRelation() : mixed
- Get a specified relationship.
- getRelations() : array<string|int, mixed>
- Get all the loaded relations for the instance.
- getRelationValue() : mixed
- Get a relationship.
- getRouteKey() : mixed
- Get the value of the model's route key.
- getRouteKeyName() : string
- Get the route key for the model.
- getTable() : string
- Get the table associated with the model.
- getTouchedRelations() : array<string|int, mixed>
- Get the relationships that are touched on save.
- getUpdatedAtColumn() : string|null
- Get the name of the "updated at" column.
- getVisible() : array<string|int, mixed>
- Get the visible attributes for the model.
- guard() : $this
- Set the guarded attributes for the model.
- handleLazyLoadingViolationUsing() : void
- Register a callback that is responsible for handling lazy loading violations.
- hasAppended() : bool
- Return whether the accessor attribute has been appended.
- hasAttributeGetMutator() : bool
- Determine if a "Attribute" return type marked get mutator exists for an attribute.
- hasAttributeMutator() : bool
- Determine if a "Attribute" return type marked mutator exists for an attribute.
- hasAttributeSetMutator() : bool
- Determine if an "Attribute" return type marked set mutator exists for an attribute.
- hasCast() : bool
- Determine whether an attribute should be cast to a native type.
- hasGetMutator() : bool
- Determine if a get mutator exists for an attribute.
- hasGlobalScope() : bool
- Determine if a model has a global scope.
- hasMany() : HasMany
- Define a one-to-many relationship.
- hasManyThrough() : HasManyThrough
- Define a has-many-through relationship.
- hasNamedScope() : bool
- Determine if the model has a given scope.
- hasOne() : HasOne
- Define a one-to-one relationship.
- hasOneThrough() : HasOneThrough
- Define a has-one-through relationship.
- hasSetMutator() : bool
- Determine if a set mutator exists for an attribute.
- is() : bool
- Determine if two models have the same ID and belong to the same table.
- isClean() : bool
- Determine if the model or all the given attribute(s) have remained the same.
- isDirty() : bool
- Determine if the model or any of the given attribute(s) have been modified.
- isFillable() : bool
- Determine if the given attribute may be mass assigned.
- isGuarded() : bool
- Determine if the given key is guarded.
- isIgnoringTouch() : bool
- Determine if the given model is ignoring touches.
- isNot() : bool
- Determine if two models are not the same.
- isRelation() : bool
- Determine if the given key is a relationship method on the model.
- isUnguarded() : bool
- Determine if the current state is "unguarded".
- joiningTable() : string
- Get the joining table name for a many-to-many relation.
- joiningTableSegment() : string
- Get this model's half of the intermediate table name for belongsToMany relationships.
- jsonSerialize() : array<string|int, mixed>
- Convert the object into something JSON serializable.
- load() : $this
- Eager load relations on the model.
- loadAggregate() : $this
- Eager load relation's column aggregations on the model.
- loadAvg() : $this
- Eager load relation average column values on the model.
- loadCount() : $this
- Eager load relation counts on the model.
- loadExists() : $this
- Eager load related model existence values on the model.
- loadMax() : $this
- Eager load relation max column values on the model.
- loadMin() : $this
- Eager load relation min column values on the model.
- loadMissing() : $this
- Eager load relations on the model if they are not already eager loaded.
- loadMorph() : $this
- Eager load relationships on the polymorphic relation of a model.
- loadMorphAggregate() : $this
- Eager load relationship column aggregation on the polymorphic relation of a model.
- loadMorphAvg() : $this
- Eager load relationship average column values on the polymorphic relation of a model.
- loadMorphCount() : $this
- Eager load relationship counts on the polymorphic relation of a model.
- loadMorphMax() : $this
- Eager load relationship max column values on the polymorphic relation of a model.
- loadMorphMin() : $this
- Eager load relationship min column values on the polymorphic relation of a model.
- loadMorphSum() : $this
- Eager load relationship column summations on the polymorphic relation of a model.
- loadSum() : $this
- Eager load relation's column summations on the model.
- makeHidden() : $this
- Make the given, typically visible, attributes hidden.
- makeHiddenIf() : $this
- Make the given, typically visible, attributes hidden if the given truth test passes.
- makeVisible() : $this
- Make the given, typically hidden, attributes visible.
- makeVisibleIf() : $this
- Make the given, typically hidden, attributes visible if the given truth test passes.
- mergeCasts() : $this
- Merge new casts with existing casts on the model.
- mergeFillable() : $this
- Merge new fillable attributes with existing fillable attributes on the model.
- mergeGuarded() : $this
- Merge new guarded attributes with existing guarded attributes on the model.
- morphedByMany() : MorphToMany
- Define a polymorphic, inverse many-to-many relationship.
- morphMany() : MorphMany
- Define a polymorphic one-to-many relationship.
- morphOne() : MorphOne
- Define a polymorphic one-to-one relationship.
- morphTo() : MorphTo
- Define a polymorphic, inverse one-to-one or many relationship.
- morphToMany() : MorphToMany
- Define a polymorphic many-to-many relationship.
- newCollection() : Collection
- Create a new Eloquent Collection instance.
- newEloquentBuilder() : Builder|static
- Create a new Eloquent query builder for the model.
- newFromBuilder() : static
- Create a new model instance that is existing.
- newInstance() : static
- Create a new instance of the given model.
- newModelQuery() : Builder|static
- Get a new query builder that doesn't have any global scopes or eager loading.
- newPivot() : Pivot
- Create a new pivot model instance.
- newQuery() : Builder
- Get a new query builder for the model's table.
- newQueryForRestoration() : Builder
- Get a new query to restore one or more models by their queueable IDs.
- newQueryWithoutRelationships() : Builder
- Get a new query builder with no relationships loaded.
- newQueryWithoutScope() : Builder
- Get a new query instance without a given scope.
- newQueryWithoutScopes() : Builder|static
- Get a new query builder that doesn't have any global scopes.
- observe() : void
- Register observers with the model.
- offsetExists() : bool
- Determine if the given attribute exists.
- offsetGet() : mixed
- Get the value for a given offset.
- offsetSet() : void
- Set the value for a given offset.
- offsetUnset() : void
- Unset the value for a given offset.
- on() : Builder
- Begin querying the model on a given connection.
- only() : array<string|int, mixed>
- Get a subset of the model's attributes.
- onWriteConnection() : Builder
- Begin querying the model on the write connection.
- originalIsEquivalent() : bool
- Determine if the new and old values for a given key are equivalent.
- preventLazyLoading() : void
- Prevent model relationships from being lazy loaded.
- preventsLazyLoading() : bool
- Determine if lazy loading is disabled.
- push() : bool
- Save the model and all of its relationships.
- qualifyColumn() : string
- Qualify the given column name by the model's table.
- qualifyColumns() : array<string|int, mixed>
- Qualify the given columns with the model's table.
- query() : Builder
- Begin querying the model.
- refresh() : $this
- Reload the current model instance with fresh attributes from the database.
- registerGlobalScopes() : Builder
- Register the global scopes for this builder instance.
- reguard() : void
- Enable the mass assignment restrictions.
- relationLoaded() : bool
- Determine if the given relation is loaded.
- relationsToArray() : array<string|int, mixed>
- Get the model's relationships in array form.
- removeObservableEvents() : void
- Remove an observable event name.
- replicate() : static
- Clone the model into a new, non-existing instance.
- replicating() : void
- Register a replicating model event with the dispatcher.
- resolveChildRouteBinding() : Model|null
- Retrieve the child model for a bound value.
- resolveConnection() : Connection
- Resolve a connection instance.
- resolveRelationUsing() : void
- Define a dynamic relation resolver.
- resolveRouteBinding() : Model|null
- Retrieve the model for a bound value.
- resolveRouteBindingQuery() : Relation
- Retrieve the model for a bound value.
- resolveSoftDeletableChildRouteBinding() : Model|null
- Retrieve the child model for a bound value.
- resolveSoftDeletableRouteBinding() : Model|null
- Retrieve the model for a bound value.
- retrieved() : void
- Register a retrieved model event with the dispatcher.
- save() : bool
- Save the model to the database.
- saved() : void
- Register a saved model event with the dispatcher.
- saveOrFail() : bool
- Save the model to the database within a transaction.
- saveQuietly() : bool
- Save the model to the database without raising any events.
- saving() : void
- Register a saving model event with the dispatcher.
- setAppends() : $this
- Set the accessors to append to model arrays.
- setAttribute() : mixed
- Set a given attribute on the model.
- setConnection() : $this
- Set the connection associated with the model.
- setConnectionResolver() : void
- Set the connection resolver instance.
- setCreatedAt() : $this
- Set the value of the "created at" attribute.
- setDateFormat() : $this
- Set the date format used by the model.
- setEventDispatcher() : void
- Set the event dispatcher instance.
- setHidden() : $this
- Set the hidden attributes for the model.
- setIncrementing() : $this
- Set whether IDs are incrementing.
- setKeyName() : $this
- Set the primary key for the model.
- setKeyType() : $this
- Set the data type for the primary key.
- setObservableEvents() : $this
- Set the observable event names.
- setPerPage() : $this
- Set the number of models to return per page.
- setRawAttributes() : $this
- Set the array of model attributes. No checking is done.
- setRelation() : $this
- Set the given relationship on the model.
- setRelations() : $this
- Set the entire relations array on the model.
- setTable() : $this
- Set the table associated with the model.
- setTouchedRelations() : $this
- Set the relationships that are touched on save.
- setUpdatedAt() : $this
- Set the value of the "updated at" attribute.
- setVisible() : $this
- Set the visible attributes for the model.
- syncChanges() : $this
- Sync the changed attributes.
- syncOriginal() : $this
- Sync the original attributes with the current.
- syncOriginalAttribute() : $this
- Sync a single original attribute with its current value.
- syncOriginalAttributes() : $this
- Sync multiple original attribute with their current values.
- toArray() : array<string|int, mixed>
- Convert the model instance to an array.
- toJson() : string
- Convert the model instance to JSON.
- totallyGuarded() : bool
- Determine if the model is totally guarded.
- touch() : bool
- Update the model's update timestamp.
- touches() : bool
- Determine if the model touches a given relation.
- touchOwners() : void
- Touch the owning relations of the model.
- unguard() : void
- Disable all mass assignable restrictions.
- unguarded() : mixed
- Run the given callable while being unguarded.
- unsetConnectionResolver() : void
- Unset the connection resolver for models.
- unsetEventDispatcher() : void
- Unset the event dispatcher for models.
- unsetRelation() : $this
- Unset a loaded relationship.
- unsetRelations() : $this
- Unset all the loaded relations for the instance.
- update() : bool
- Update the model in the database.
- updated() : void
- Register an updated model event with the dispatcher.
- updateOrFail() : bool
- Update the model in the database within a transaction.
- updateQuietly() : bool
- Update the model in the database without raising any events.
- updateTimestamps() : void
- Update the creation and update timestamps.
- updating() : void
- Register an updating model event with the dispatcher.
- usesTimestamps() : bool
- Determine if the model uses timestamps.
- wasChanged() : bool
- Determine if the model or any of the given attribute(s) have been modified.
- with() : Builder
- Begin querying a model with eager loading.
- withoutBroadcasting() : mixed
- Execute a callback without broadcasting any model events for all model types.
- withoutEvents() : mixed
- Execute a callback without firing any model events for any model type.
- withoutRelations() : $this
- Duplicate the instance and unset all the loaded relations.
- withoutTouching() : void
- Disables relationship model touching for the current class during given callback scope.
- withoutTouchingOn() : void
- Disables relationship model touching for the given model classes during given callback scope.
- addCastAttributesToArray() : array<string|int, mixed>
- Add the casted attributes to the attributes array.
- addDateAttributesToArray() : array<string|int, mixed>
- Add the date attributes to the attributes array.
- addMutatedAttributesToArray() : array<string|int, mixed>
- Add the mutated attributes to the attributes array.
- asDate() : Carbon
- Return a timestamp as DateTime object with time set to 00:00:00.
- asDateTime() : Carbon
- Return a timestamp as DateTime object.
- asDecimal() : string
- Return a decimal as string.
- asJson() : string
- Encode the given value as JSON.
- asTimestamp() : int
- Return a timestamp as unix timestamp.
- boot() : void
- Bootstrap the model and its traits.
- booted() : void
- Perform any actions required after the model boots.
- bootIfNotBooted() : void
- Check if the model needs to be booted and if so, do it.
- booting() : void
- Perform any actions required before the model boots.
- bootTraits() : void
- Boot all of the bootable traits on the model.
- castAttribute() : mixed
- Cast an attribute to a native PHP type.
- castAttributeAsEncryptedString() : string
- Cast the given attribute to an encrypted string.
- castAttributeAsJson() : string
- Cast the given attribute to JSON.
- decrement() : int
- Decrement a column's value by a given amount.
- deviateClassCastableAttribute() : mixed
- Increment or decrement the given attribute using the custom cast class.
- fillableFromArray() : array<string|int, mixed>
- Get the fillable attributes of a given array.
- filterModelEventResults() : mixed
- Filter the model event results.
- finishSave() : void
- Perform any actions that are necessary after the model is saved.
- fireCustomModelEvent() : mixed|null
- Fire a custom model event for the given event.
- fireModelEvent() : mixed
- Fire the given event for the model.
- forwardCallTo() : mixed
- Forward a method call to the given object.
- forwardDecoratedCallTo() : mixed
- Forward a method call to the given object, returning $this if the forwarded call returned itself.
- getArrayableAppends() : array<string|int, mixed>
- Get all of the appendable values that are arrayable.
- getArrayableAttributes() : array<string|int, mixed>
- Get an attribute array of all arrayable attributes.
- getArrayableItems() : array<string|int, mixed>
- Get an attribute array of all arrayable values.
- getArrayableRelations() : array<string|int, mixed>
- Get an attribute array of all arrayable relations.
- getArrayAttributeByKey() : array<string|int, mixed>
- Get an array attribute or return an empty array if it is not set.
- getArrayAttributeWithValue() : $this
- Get an array attribute with the given key and value set.
- getAttributeFromArray() : mixed
- Get an attribute from the $attributes array.
- getAttributeMarkedMutatorMethods() : array<string|int, mixed>
- Get all of the "Attribute" return typed attribute mutator methods.
- getAttributesForInsert() : array<string|int, mixed>
- Get all of the current attributes on the model for an insert operation.
- getCastType() : string
- Get the type of cast for a model attribute.
- getClassCastableAttributeValue() : mixed
- Cast the given attribute using a custom cast class.
- getEnumCastableAttributeValue() : mixed
- Cast the given attribute to an enum.
- getKeyForSaveQuery() : mixed
- Get the primary key value for a save query.
- getKeyForSelectQuery() : mixed
- Get the primary key value for a select query.
- getMorphs() : array<string|int, mixed>
- Get the polymorphic relationship columns.
- getMutatorMethods() : array<string|int, mixed>
- Get all of the attribute mutator methods.
- getOriginalWithoutRewindingModel() : mixed|array<string|int, mixed>
- Get the model's original attribute values.
- getRelationshipFromMethod() : mixed
- Get a relationship value from a method.
- guessBelongsToManyRelation() : string|null
- Get the relationship name of the belongsToMany relationship.
- guessBelongsToRelation() : string
- Guess the "belongs to" relationship name.
- handleLazyLoadingViolation() : mixed
- Handle a lazy loading violation.
- hasChanges() : bool
- Determine if any of the given attributes were changed.
- increment() : int
- Increment a column's value by a given amount.
- incrementOrDecrement() : int
- Run the increment or decrement method on the model.
- initializeTraits() : void
- Initialize any initializable traits on the model.
- insertAndSetId() : void
- Insert the given attributes and set the ID on the model.
- isClassCastable() : bool
- Determine if the given key is cast using a custom class.
- isClassDeviable() : bool
- Determine if the key is deviable using a custom class.
- isClassSerializable() : bool
- Determine if the key is serializable using a custom class.
- isCustomDateTimeCast() : bool
- Determine if the cast type is a custom date time cast.
- isDateAttribute() : bool
- Determine if the given attribute is a date or date castable.
- isDateCastable() : bool
- Determine whether a value is Date / DateTime castable for inbound manipulation.
- isDateCastableWithCustomFormat() : bool
- Determine whether a value is Date / DateTime custom-castable for inbound manipulation.
- isDecimalCast() : bool
- Determine if the cast type is a decimal cast.
- isEncryptedCastable() : bool
- Determine whether a value is an encrypted castable for inbound manipulation.
- isEnumCastable() : bool
- Determine if the given key is cast using an enum.
- isGuardableColumn() : bool
- Determine if the given column is a valid, guardable column.
- isImmutableCustomDateTimeCast() : bool
- Determine if the cast type is an immutable custom date time cast.
- isJsonCastable() : bool
- Determine whether a value is JSON castable for inbound manipulation.
- isStandardDateFormat() : bool
- Determine if the given value is a standard date format.
- mergeAttributesFromAttributeCasts() : void
- Merge the cast class attributes back into the model.
- mergeAttributesFromCachedCasts() : void
- Merge the cast class and attribute cast attributes back into the model.
- mergeAttributesFromClassCasts() : void
- Merge the cast class attributes back into the model.
- morphEagerTo() : MorphTo
- Define a polymorphic, inverse one-to-one or many relationship.
- morphInstanceTo() : MorphTo
- Define a polymorphic, inverse one-to-one or many relationship.
- mutateAttribute() : mixed
- Get the value of an attribute using its mutator.
- mutateAttributeForArray() : mixed
- Get the value of an attribute using its mutator for array conversion.
- mutateAttributeMarkedAttribute() : mixed
- Get the value of an "Attribute" return type marked attribute using its mutator.
- newBaseQueryBuilder() : Builder
- Get a new query builder instance for the connection.
- newBelongsTo() : BelongsTo
- Instantiate a new BelongsTo relationship.
- newBelongsToMany() : BelongsToMany
- Instantiate a new BelongsToMany relationship.
- newHasMany() : HasMany
- Instantiate a new HasMany relationship.
- newHasManyThrough() : HasManyThrough
- Instantiate a new HasManyThrough relationship.
- newHasOne() : HasOne
- Instantiate a new HasOne relationship.
- newHasOneThrough() : HasOneThrough
- Instantiate a new HasOneThrough relationship.
- newMorphMany() : MorphMany
- Instantiate a new MorphMany relationship.
- newMorphOne() : MorphOne
- Instantiate a new MorphOne relationship.
- newMorphTo() : MorphTo
- Instantiate a new MorphTo relationship.
- newMorphToMany() : MorphToMany
- Instantiate a new MorphToMany relationship.
- newRelatedInstance() : mixed
- Create a new model instance for a related model.
- normalizeCastClassResponse() : array<string|int, mixed>
- Normalize the response from a custom class caster.
- parseCasterClass() : string
- Parse the given caster class, removing any arguments.
- performDeleteOnModel() : void
- Perform the actual delete query on this model instance.
- performInsert() : bool
- Perform a model insert operation.
- performUpdate() : bool
- Perform a model update operation.
- registerModelEvent() : void
- Register a model event with the dispatcher.
- registerObserver() : void
- Register a single observer with the model.
- resolveCasterClass() : mixed
- Resolve the custom caster class for a given key.
- resolveChildRouteBindingQuery() : Relation
- Retrieve the child model query for a bound value.
- serializeClassCastableAttribute() : mixed
- Serialize the given attribute using the custom cast class.
- serializeDate() : string
- Prepare a date for array / JSON serialization.
- setAttributeMarkedMutatedAttributeValue() : mixed
- Set the value of a "Attribute" return type marked attribute using its mutator.
- setClassCastableAttribute() : void
- Set the value of a class castable attribute.
- setEnumCastableAttribute() : void
- Set the value of an enum castable attribute.
- setKeysForSaveQuery() : Builder
- Set the keys for a save update query.
- setKeysForSelectQuery() : Builder
- Set the keys for a select query.
- setMutatedAttributeValue() : mixed
- Set the value of an attribute using its mutator.
- throwBadMethodCallException() : void
- Throw a bad method call exception for the given method.
- transformModelValue() : mixed
- Transform a raw model value using mutators, casts, etc.
- resolveObserverClassName() : string
- Resolve the observer's class name from an object or string.
Constants
CREATED_AT
The name of the "created at" column.
public
string|null
CREATED_AT
= 'created_at'
UPDATED_AT
The name of the "updated at" column.
public
string|null
UPDATED_AT
= 'updated_at'
Properties
$encrypter
The encrypter instance that is used to encrypt attributes.
public
static Encrypter
$encrypter
$exists
Indicates if the model exists.
public
bool
$exists
= false
$incrementing
Indicates if the IDs are auto-incrementing.
public
bool
$incrementing
= true
$manyMethods
The many to many relationship methods.
public
static array<string|int, string>
$manyMethods
= ['belongsToMany', 'morphToMany', 'morphedByMany']
$preventsLazyLoading
Indicates whether lazy loading will be prevented on this model.
public
bool
$preventsLazyLoading
= false
$snakeAttributes
Indicates whether attributes are snake cased on arrays.
public
static bool
$snakeAttributes
= true
$timestamps
Indicates if the model should be timestamped.
public
bool
$timestamps
= true
$wasRecentlyCreated
Indicates if the model was inserted during the current request lifecycle.
public
bool
$wasRecentlyCreated
= false
$appends
The accessors to append to the model's array form.
protected
array<string|int, mixed>
$appends
= []
$attributeCastCache
The attributes that have been cast using "Attribute" return type mutators.
protected
array<string|int, mixed>
$attributeCastCache
= []
$attributeMutatorCache
The cache of the "Attribute" return type marked mutated attributes for each class.
protected
static array<string|int, mixed>
$attributeMutatorCache
= []
$attributes
The model's attributes.
protected
array<string|int, mixed>
$attributes
= []
$booted
The array of booted models.
protected
static array<string|int, mixed>
$booted
= []
$casts
The attributes that should be cast.
protected
array<string|int, mixed>
$casts
= []
$changes
The changed model attributes.
protected
array<string|int, mixed>
$changes
= []
$classCastCache
The attributes that have been cast using custom classes.
protected
array<string|int, mixed>
$classCastCache
= []
$connection
The connection name for the model.
protected
string|null
$connection
$dateFormat
The storage format of the model's date columns.
protected
string
$dateFormat
$dates
The attributes that should be mutated to dates.
Use the "casts" property
protected
array<string|int, mixed>
$dates
= []
$dispatcher
The event dispatcher instance.
protected
static Dispatcher
$dispatcher
$dispatchesEvents
The event map for the model.
protected
array<string|int, mixed>
$dispatchesEvents
= []
Allows for object-based events for native Eloquent events.
$escapeWhenCastingToString
Indicates that the object's string representation should be escaped when __toString is invoked.
protected
bool
$escapeWhenCastingToString
= false
$fillable
The attributes that are mass assignable.
protected
array<string|int, string>
$fillable
= []
$getAttributeMutatorCache
The cache of the "Attribute" return type marked mutated, gettable attributes for each class.
protected
static array<string|int, mixed>
$getAttributeMutatorCache
= []
$globalScopes
The array of global scopes on the model.
protected
static array<string|int, mixed>
$globalScopes
= []
$guardableColumns
The actual columns that exist on the database and can be guarded.
protected
static array<string|int, mixed>
$guardableColumns
= []
$guarded
The attributes that aren't mass assignable.
protected
array<string|int, string>|bool
$guarded
= ['*']
$hidden
The attributes that should be hidden for serialization.
protected
array<string|int, mixed>
$hidden
= []
$ignoreOnTouch
The list of models classes that should not be affected with touch.
protected
static array<string|int, mixed>
$ignoreOnTouch
= []
$isBroadcasting
Indicates if broadcasting is currently enabled.
protected
static bool
$isBroadcasting
= true
$keyType
The "type" of the primary key ID.
protected
string
$keyType
= 'int'
$lazyLoadingViolationCallback
The callback that is responsible for handling lazy loading violations.
protected
static callable|null
$lazyLoadingViolationCallback
$modelsShouldPreventLazyLoading
Indicates whether lazy loading should be restricted on all models.
protected
static bool
$modelsShouldPreventLazyLoading
= false
$mutatorCache
The cache of the mutated attributes for each class.
protected
static array<string|int, mixed>
$mutatorCache
= []
$observables
User exposed observable events.
protected
array<string|int, mixed>
$observables
= []
These are extra user-defined events observers may subscribe to.
$original
The model attribute's original state.
protected
array<string|int, mixed>
$original
= []
$perPage
The number of models to return for pagination.
protected
int
$perPage
= 15
$primaryKey
The primary key for the model.
protected
string
$primaryKey
= 'id'
$primitiveCastTypes
The built-in, primitive cast types supported by Eloquent.
protected
static array<string|int, string>
$primitiveCastTypes
= ['array', 'bool', 'boolean', 'collection', 'custom_datetime', 'date', 'datetime', 'decimal', 'double', 'encrypted', 'encrypted:array', 'encrypted:collection', 'encrypted:json', 'encrypted:object', 'float', 'immutable_date', 'immutable_datetime', 'immutable_custom_datetime', 'int', 'integer', 'json', 'object', 'real', 'string', 'timestamp']
$relationResolvers
The relation resolver callbacks.
protected
static array<string|int, mixed>
$relationResolvers
= []
$relations
The loaded relationships for the model.
protected
array<string|int, mixed>
$relations
= []
$resolver
The connection resolver instance.
protected
static ConnectionResolverInterface
$resolver
$setAttributeMutatorCache
The cache of the "Attribute" return type marked mutated, settable attributes for each class.
protected
static array<string|int, mixed>
$setAttributeMutatorCache
= []
$table
The table associated with the model.
protected
string
$table
$touches
The relationships that should be touched on save.
protected
array<string|int, mixed>
$touches
= []
$traitInitializers
The array of trait initializers that will be called on each new instance.
protected
static array<string|int, mixed>
$traitInitializers
= []
$unguarded
Indicates if all mass assignment is enabled.
protected
static bool
$unguarded
= false
$visible
The attributes that should be visible in serialization.
protected
array<string|int, mixed>
$visible
= []
$with
The relations to eager load on every query.
protected
array<string|int, mixed>
$with
= []
$withCount
The relationship counts that should be eager loaded on every query.
protected
array<string|int, mixed>
$withCount
= []
Methods
__call()
Handle dynamic method calls into the model.
public
__call(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
__callStatic()
Handle dynamic static method calls into the model.
public
static __callStatic(string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $method : string
- $parameters : array<string|int, mixed>
__construct()
Create a new Eloquent model instance.
public
__construct([array<string|int, mixed> $attributes = [] ]) : void
Parameters
- $attributes : array<string|int, mixed> = []
__get()
Dynamically retrieve attributes on the model.
public
__get(string $key) : mixed
Parameters
- $key : string
__isset()
Determine if an attribute or relation exists on the model.
public
__isset(string $key) : bool
Parameters
- $key : string
Return values
bool__set()
Dynamically set attributes on the model.
public
__set(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
__sleep()
Prepare the object for serialization.
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__toString()
Convert the model to its string representation.
public
__toString() : string
Return values
string__unset()
Unset an attribute on the model.
public
__unset(string $key) : void
Parameters
- $key : string
__wakeup()
When a model is being unserialized, check if it needs to be booted.
public
__wakeup() : void
addGlobalScope()
Register a new global scope on the model.
public
static addGlobalScope(Scope|Closure|string $scope[, Closure|null $implementation = null ]) : mixed
Parameters
- $scope : Scope|Closure|string
- $implementation : Closure|null = null
Tags
addObservableEvents()
Add an observable event name.
public
addObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
- $observables : array<string|int, mixed>|mixed
all()
Get all of the models from the database.
public
static all([array<string|int, mixed>|mixed $columns = ['*'] ]) : Collection|array<string|int, static>
Parameters
- $columns : array<string|int, mixed>|mixed = ['*']
Return values
Collection|array<string|int, static>append()
Append attributes to query when building a query.
public
append(array<string|int, mixed>|string $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>|string
Return values
$thisattributesToArray()
Convert the model's attributes to an array.
public
attributesToArray() : array<string|int, mixed>
Return values
array<string|int, mixed>belongsTo()
Define an inverse one-to-one or many relationship.
public
belongsTo(string $related[, string|null $foreignKey = null ][, string|null $ownerKey = null ][, string|null $relation = null ]) : BelongsTo
Parameters
- $related : string
- $foreignKey : string|null = null
- $ownerKey : string|null = null
- $relation : string|null = null
Return values
BelongsTobelongsToMany()
Define a many-to-many relationship.
public
belongsToMany(string $related[, string|null $table = null ][, string|null $foreignPivotKey = null ][, string|null $relatedPivotKey = null ][, string|null $parentKey = null ][, string|null $relatedKey = null ][, string|null $relation = null ]) : BelongsToMany
Parameters
- $related : string
- $table : string|null = null
- $foreignPivotKey : string|null = null
- $relatedPivotKey : string|null = null
- $parentKey : string|null = null
- $relatedKey : string|null = null
- $relation : string|null = null
Return values
BelongsToManybroadcastChannel()
Get the broadcast channel name that is associated with the given entity.
public
broadcastChannel() : string
Return values
stringbroadcastChannelRoute()
Get the broadcast channel route definition that is associated with the given entity.
public
broadcastChannelRoute() : string
Return values
stringcacheMutatedAttributes()
Extract and cache all the mutated attributes of a class.
public
static cacheMutatedAttributes(string $class) : void
Parameters
- $class : string
callNamedScope()
Apply the given named scope if possible.
public
callNamedScope(string $scope[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $scope : string
- $parameters : array<string|int, mixed> = []
clearBootedModels()
Clear the list of booted models so they will be re-booted.
public
static clearBootedModels() : void
created()
Register a created model event with the dispatcher.
public
static created(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
creating()
Register a creating model event with the dispatcher.
public
static creating(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
delete()
Delete the model from the database.
public
delete() : bool|null
Tags
Return values
bool|nulldeleted()
Register a deleted model event with the dispatcher.
public
static deleted(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
deleteOrFail()
Delete the model from the database within a transaction.
public
deleteOrFail() : bool|null
Tags
Return values
bool|nulldeleting()
Register a deleting model event with the dispatcher.
public
static deleting(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
destroy()
Destroy the models for the given IDs.
public
static destroy(Collection|array<string|int, mixed>|int|string $ids) : int
Parameters
- $ids : Collection|array<string|int, mixed>|int|string
Return values
intencryptUsing()
Set the encrypter instance that will be used to encrypt attributes.
public
static encryptUsing(Encrypter $encrypter) : void
Parameters
- $encrypter : Encrypter
escapeWhenCastingToString()
Indicate that the object's string representation should be escaped when __toString is invoked.
public
escapeWhenCastingToString([bool $escape = true ]) : $this
Parameters
- $escape : bool = true
Return values
$thisfill()
Fill the model with an array of attributes.
public
fill(array<string|int, mixed> $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>
Tags
Return values
$thisfillable()
Set the fillable attributes for the model.
public
fillable(array<string|int, mixed> $fillable) : $this
Parameters
- $fillable : array<string|int, mixed>
Return values
$thisfillJsonAttribute()
Set a given JSON attribute on the model.
public
fillJsonAttribute(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$thisflushEventListeners()
Remove all of the event listeners for the model.
public
static flushEventListeners() : void
forceDelete()
Force a hard delete on a soft deleted model.
public
forceDelete() : bool|null
This method protects developers from running forceDelete when the trait is missing.
Return values
bool|nullforceFill()
Fill the model with an array of attributes. Force mass assignment.
public
forceFill(array<string|int, mixed> $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>
Return values
$thisfresh()
Reload a fresh model instance from the database.
public
fresh([array<string|int, mixed>|string $with = [] ]) : static|null
Parameters
- $with : array<string|int, mixed>|string = []
Return values
static|nullfreshTimestamp()
Get a fresh timestamp for the model.
public
freshTimestamp() : Carbon
Return values
CarbonfreshTimestampString()
Get a fresh timestamp for the model.
public
freshTimestampString() : string
Return values
stringfromDateTime()
Convert a DateTime to a storable string.
public
fromDateTime(mixed $value) : string|null
Parameters
- $value : mixed
Return values
string|nullfromEncryptedString()
Decrypt the given encrypted string.
public
fromEncryptedString(string $value) : mixed
Parameters
- $value : string
fromFloat()
Decode the given float.
public
fromFloat(mixed $value) : mixed
Parameters
- $value : mixed
fromJson()
Decode the given JSON back into an array or object.
public
fromJson(string $value[, bool $asObject = false ]) : mixed
Parameters
- $value : string
- $asObject : bool = false
getActualClassNameForMorph()
Retrieve the actual class name for a given morph class.
public
static getActualClassNameForMorph(string $class) : string
Parameters
- $class : string
Return values
stringgetAttribute()
Get an attribute from the model.
public
getAttribute(string $key) : mixed
Parameters
- $key : string
getAttributes()
Get all of the current attributes on the model.
public
getAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getAttributeValue()
Get a plain attribute (not a relationship).
public
getAttributeValue(string $key) : mixed
Parameters
- $key : string
getCasts()
Get the casts array.
public
getCasts() : array<string|int, mixed>
Return values
array<string|int, mixed>getChanges()
Get the attributes that were changed.
public
getChanges() : array<string|int, mixed>
Return values
array<string|int, mixed>getConnection()
Get the database connection for the model.
public
getConnection() : Connection
Return values
ConnectiongetConnectionName()
Get the current connection name for the model.
public
getConnectionName() : string|null
Return values
string|nullgetConnectionResolver()
Get the connection resolver instance.
public
static getConnectionResolver() : ConnectionResolverInterface
Return values
ConnectionResolverInterfacegetCreatedAtColumn()
Get the name of the "created at" column.
public
getCreatedAtColumn() : string|null
Return values
string|nullgetDateFormat()
Get the format for database stored dates.
public
getDateFormat() : string
Return values
stringgetDates()
Get the attributes that should be converted to dates.
public
getDates() : array<string|int, mixed>
Return values
array<string|int, mixed>getDirty()
Get the attributes that have been changed since the last sync.
public
getDirty() : array<string|int, mixed>
Return values
array<string|int, mixed>getEventDispatcher()
Get the event dispatcher instance.
public
static getEventDispatcher() : Dispatcher
Return values
DispatchergetFillable()
Get the fillable attributes for the model.
public
getFillable() : array<string|int, mixed>
Return values
array<string|int, mixed>getForeignKey()
Get the default foreign key name for the model.
public
getForeignKey() : string
Return values
stringgetGlobalScope()
Get a global scope registered with the model.
public
static getGlobalScope(Scope|string $scope) : Scope|Closure|null
Parameters
- $scope : Scope|string
Return values
Scope|Closure|nullgetGlobalScopes()
Get the global scopes for this class instance.
public
getGlobalScopes() : array<string|int, mixed>
Return values
array<string|int, mixed>getGuarded()
Get the guarded attributes for the model.
public
getGuarded() : array<string|int, mixed>
Return values
array<string|int, mixed>getHidden()
Get the hidden attributes for the model.
public
getHidden() : array<string|int, mixed>
Return values
array<string|int, mixed>getIncrementing()
Get the value indicating whether the IDs are incrementing.
public
getIncrementing() : bool
Return values
boolgetKey()
Get the value of the model's primary key.
public
getKey() : mixed
getKeyName()
Get the primary key for the model.
public
getKeyName() : string
Return values
stringgetKeyType()
Get the auto-incrementing key type.
public
getKeyType() : string
Return values
stringgetMorphClass()
Get the class name for polymorphic relations.
public
getMorphClass() : string
Return values
stringgetMutatedAttributes()
Get the mutated attributes for a given instance.
public
getMutatedAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getObservableEvents()
Get the observable event names.
public
getObservableEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>getOriginal()
Get the model's original attribute values.
public
getOriginal([string|null $key = null ][, mixed $default = null ]) : mixed|array<string|int, mixed>
Parameters
- $key : string|null = null
- $default : mixed = null
Return values
mixed|array<string|int, mixed>getPerPage()
Get the number of models to return per page.
public
getPerPage() : int
Return values
intgetQualifiedCreatedAtColumn()
Get the fully qualified "created at" column.
public
getQualifiedCreatedAtColumn() : string|null
Return values
string|nullgetQualifiedKeyName()
Get the table qualified key name.
public
getQualifiedKeyName() : string
Return values
stringgetQualifiedUpdatedAtColumn()
Get the fully qualified "updated at" column.
public
getQualifiedUpdatedAtColumn() : string|null
Return values
string|nullgetQueueableConnection()
Get the queueable connection for the entity.
public
getQueueableConnection() : string|null
Return values
string|nullgetQueueableId()
Get the queueable identity for the entity.
public
getQueueableId() : mixed
getQueueableRelations()
Get the queueable relationships for the entity.
public
getQueueableRelations() : array<string|int, mixed>
Return values
array<string|int, mixed>getRawOriginal()
Get the model's raw original attribute values.
public
getRawOriginal([string|null $key = null ][, mixed $default = null ]) : mixed|array<string|int, mixed>
Parameters
- $key : string|null = null
- $default : mixed = null
Return values
mixed|array<string|int, mixed>getRelation()
Get a specified relationship.
public
getRelation(string $relation) : mixed
Parameters
- $relation : string
getRelations()
Get all the loaded relations for the instance.
public
getRelations() : array<string|int, mixed>
Return values
array<string|int, mixed>getRelationValue()
Get a relationship.
public
getRelationValue(string $key) : mixed
Parameters
- $key : string
getRouteKey()
Get the value of the model's route key.
public
getRouteKey() : mixed
getRouteKeyName()
Get the route key for the model.
public
getRouteKeyName() : string
Return values
stringgetTable()
Get the table associated with the model.
public
getTable() : string
Return values
stringgetTouchedRelations()
Get the relationships that are touched on save.
public
getTouchedRelations() : array<string|int, mixed>
Return values
array<string|int, mixed>getUpdatedAtColumn()
Get the name of the "updated at" column.
public
getUpdatedAtColumn() : string|null
Return values
string|nullgetVisible()
Get the visible attributes for the model.
public
getVisible() : array<string|int, mixed>
Return values
array<string|int, mixed>guard()
Set the guarded attributes for the model.
public
guard(array<string|int, mixed> $guarded) : $this
Parameters
- $guarded : array<string|int, mixed>
Return values
$thishandleLazyLoadingViolationUsing()
Register a callback that is responsible for handling lazy loading violations.
public
static handleLazyLoadingViolationUsing(callable|null $callback) : void
Parameters
- $callback : callable|null
hasAppended()
Return whether the accessor attribute has been appended.
public
hasAppended(string $attribute) : bool
Parameters
- $attribute : string
Return values
boolhasAttributeGetMutator()
Determine if a "Attribute" return type marked get mutator exists for an attribute.
public
hasAttributeGetMutator(string $key) : bool
Parameters
- $key : string
Return values
boolhasAttributeMutator()
Determine if a "Attribute" return type marked mutator exists for an attribute.
public
hasAttributeMutator(string $key) : bool
Parameters
- $key : string
Return values
boolhasAttributeSetMutator()
Determine if an "Attribute" return type marked set mutator exists for an attribute.
public
hasAttributeSetMutator(string $key) : bool
Parameters
- $key : string
Return values
boolhasCast()
Determine whether an attribute should be cast to a native type.
public
hasCast(string $key[, array<string|int, mixed>|string|null $types = null ]) : bool
Parameters
- $key : string
- $types : array<string|int, mixed>|string|null = null
Return values
boolhasGetMutator()
Determine if a get mutator exists for an attribute.
public
hasGetMutator(string $key) : bool
Parameters
- $key : string
Return values
boolhasGlobalScope()
Determine if a model has a global scope.
public
static hasGlobalScope(Scope|string $scope) : bool
Parameters
- $scope : Scope|string
Return values
boolhasMany()
Define a one-to-many relationship.
public
hasMany(string $related[, string|null $foreignKey = null ][, string|null $localKey = null ]) : HasMany
Parameters
- $related : string
- $foreignKey : string|null = null
- $localKey : string|null = null
Return values
HasManyhasManyThrough()
Define a has-many-through relationship.
public
hasManyThrough(string $related, string $through[, string|null $firstKey = null ][, string|null $secondKey = null ][, string|null $localKey = null ][, string|null $secondLocalKey = null ]) : HasManyThrough
Parameters
- $related : string
- $through : string
- $firstKey : string|null = null
- $secondKey : string|null = null
- $localKey : string|null = null
- $secondLocalKey : string|null = null
Return values
HasManyThroughhasNamedScope()
Determine if the model has a given scope.
public
hasNamedScope(string $scope) : bool
Parameters
- $scope : string
Return values
boolhasOne()
Define a one-to-one relationship.
public
hasOne(string $related[, string|null $foreignKey = null ][, string|null $localKey = null ]) : HasOne
Parameters
- $related : string
- $foreignKey : string|null = null
- $localKey : string|null = null
Return values
HasOnehasOneThrough()
Define a has-one-through relationship.
public
hasOneThrough(string $related, string $through[, string|null $firstKey = null ][, string|null $secondKey = null ][, string|null $localKey = null ][, string|null $secondLocalKey = null ]) : HasOneThrough
Parameters
- $related : string
- $through : string
- $firstKey : string|null = null
- $secondKey : string|null = null
- $localKey : string|null = null
- $secondLocalKey : string|null = null
Return values
HasOneThroughhasSetMutator()
Determine if a set mutator exists for an attribute.
public
hasSetMutator(string $key) : bool
Parameters
- $key : string
Return values
boolis()
Determine if two models have the same ID and belong to the same table.
public
is(Model|null $model) : bool
Parameters
- $model : Model|null
Return values
boolisClean()
Determine if the model or all the given attribute(s) have remained the same.
public
isClean([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
- $attributes : array<string|int, mixed>|string|null = null
Return values
boolisDirty()
Determine if the model or any of the given attribute(s) have been modified.
public
isDirty([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
- $attributes : array<string|int, mixed>|string|null = null
Return values
boolisFillable()
Determine if the given attribute may be mass assigned.
public
isFillable(string $key) : bool
Parameters
- $key : string
Return values
boolisGuarded()
Determine if the given key is guarded.
public
isGuarded(string $key) : bool
Parameters
- $key : string
Return values
boolisIgnoringTouch()
Determine if the given model is ignoring touches.
public
static isIgnoringTouch([string|null $class = null ]) : bool
Parameters
- $class : string|null = null
Return values
boolisNot()
Determine if two models are not the same.
public
isNot(Model|null $model) : bool
Parameters
- $model : Model|null
Return values
boolisRelation()
Determine if the given key is a relationship method on the model.
public
isRelation(string $key) : bool
Parameters
- $key : string
Return values
boolisUnguarded()
Determine if the current state is "unguarded".
public
static isUnguarded() : bool
Return values
booljoiningTable()
Get the joining table name for a many-to-many relation.
public
joiningTable(string $related[, Model|null $instance = null ]) : string
Parameters
- $related : string
- $instance : Model|null = null
Return values
stringjoiningTableSegment()
Get this model's half of the intermediate table name for belongsToMany relationships.
public
joiningTableSegment() : string
Return values
stringjsonSerialize()
Convert the object into something JSON serializable.
public
jsonSerialize() : array<string|int, mixed>
Attributes
- #[ReturnTypeWillChange]
Return values
array<string|int, mixed>load()
Eager load relations on the model.
public
load(array<string|int, mixed>|string $relations) : $this
Parameters
- $relations : array<string|int, mixed>|string
Return values
$thisloadAggregate()
Eager load relation's column aggregations on the model.
public
loadAggregate(array<string|int, mixed>|string $relations, string $column[, string $function = null ]) : $this
Parameters
- $relations : array<string|int, mixed>|string
- $column : string
- $function : string = null
Return values
$thisloadAvg()
Eager load relation average column values on the model.
public
loadAvg(array<string|int, mixed>|string $relations, string $column) : $this
Parameters
- $relations : array<string|int, mixed>|string
- $column : string
Return values
$thisloadCount()
Eager load relation counts on the model.
public
loadCount(array<string|int, mixed>|string $relations) : $this
Parameters
- $relations : array<string|int, mixed>|string
Return values
$thisloadExists()
Eager load related model existence values on the model.
public
loadExists(array<string|int, mixed>|string $relations) : $this
Parameters
- $relations : array<string|int, mixed>|string
Return values
$thisloadMax()
Eager load relation max column values on the model.
public
loadMax(array<string|int, mixed>|string $relations, string $column) : $this
Parameters
- $relations : array<string|int, mixed>|string
- $column : string
Return values
$thisloadMin()
Eager load relation min column values on the model.
public
loadMin(array<string|int, mixed>|string $relations, string $column) : $this
Parameters
- $relations : array<string|int, mixed>|string
- $column : string
Return values
$thisloadMissing()
Eager load relations on the model if they are not already eager loaded.
public
loadMissing(array<string|int, mixed>|string $relations) : $this
Parameters
- $relations : array<string|int, mixed>|string
Return values
$thisloadMorph()
Eager load relationships on the polymorphic relation of a model.
public
loadMorph(string $relation, array<string|int, mixed> $relations) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
Return values
$thisloadMorphAggregate()
Eager load relationship column aggregation on the polymorphic relation of a model.
public
loadMorphAggregate(string $relation, array<string|int, mixed> $relations, string $column[, string $function = null ]) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
- $column : string
- $function : string = null
Return values
$thisloadMorphAvg()
Eager load relationship average column values on the polymorphic relation of a model.
public
loadMorphAvg(string $relation, array<string|int, mixed> $relations, string $column) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
- $column : string
Return values
$thisloadMorphCount()
Eager load relationship counts on the polymorphic relation of a model.
public
loadMorphCount(string $relation, array<string|int, mixed> $relations) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
Return values
$thisloadMorphMax()
Eager load relationship max column values on the polymorphic relation of a model.
public
loadMorphMax(string $relation, array<string|int, mixed> $relations, string $column) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
- $column : string
Return values
$thisloadMorphMin()
Eager load relationship min column values on the polymorphic relation of a model.
public
loadMorphMin(string $relation, array<string|int, mixed> $relations, string $column) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
- $column : string
Return values
$thisloadMorphSum()
Eager load relationship column summations on the polymorphic relation of a model.
public
loadMorphSum(string $relation, array<string|int, mixed> $relations, string $column) : $this
Parameters
- $relation : string
- $relations : array<string|int, mixed>
- $column : string
Return values
$thisloadSum()
Eager load relation's column summations on the model.
public
loadSum(array<string|int, mixed>|string $relations, string $column) : $this
Parameters
- $relations : array<string|int, mixed>|string
- $column : string
Return values
$thismakeHidden()
Make the given, typically visible, attributes hidden.
public
makeHidden(array<string|int, mixed>|string|null $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>|string|null
Return values
$thismakeHiddenIf()
Make the given, typically visible, attributes hidden if the given truth test passes.
public
makeHiddenIf(bool|Closure $condition, array<string|int, mixed>|string|null $attributes) : $this
Parameters
- $condition : bool|Closure
- $attributes : array<string|int, mixed>|string|null
Return values
$thismakeVisible()
Make the given, typically hidden, attributes visible.
public
makeVisible(array<string|int, mixed>|string|null $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>|string|null
Return values
$thismakeVisibleIf()
Make the given, typically hidden, attributes visible if the given truth test passes.
public
makeVisibleIf(bool|Closure $condition, array<string|int, mixed>|string|null $attributes) : $this
Parameters
- $condition : bool|Closure
- $attributes : array<string|int, mixed>|string|null
Return values
$thismergeCasts()
Merge new casts with existing casts on the model.
public
mergeCasts(array<string|int, mixed> $casts) : $this
Parameters
- $casts : array<string|int, mixed>
Return values
$thismergeFillable()
Merge new fillable attributes with existing fillable attributes on the model.
public
mergeFillable(array<string|int, mixed> $fillable) : $this
Parameters
- $fillable : array<string|int, mixed>
Return values
$thismergeGuarded()
Merge new guarded attributes with existing guarded attributes on the model.
public
mergeGuarded(array<string|int, mixed> $guarded) : $this
Parameters
- $guarded : array<string|int, mixed>
Return values
$thismorphedByMany()
Define a polymorphic, inverse many-to-many relationship.
public
morphedByMany(string $related, string $name[, string|null $table = null ][, string|null $foreignPivotKey = null ][, string|null $relatedPivotKey = null ][, string|null $parentKey = null ][, string|null $relatedKey = null ]) : MorphToMany
Parameters
- $related : string
- $name : string
- $table : string|null = null
- $foreignPivotKey : string|null = null
- $relatedPivotKey : string|null = null
- $parentKey : string|null = null
- $relatedKey : string|null = null
Return values
MorphToManymorphMany()
Define a polymorphic one-to-many relationship.
public
morphMany(string $related, string $name[, string|null $type = null ][, string|null $id = null ][, string|null $localKey = null ]) : MorphMany
Parameters
- $related : string
- $name : string
- $type : string|null = null
- $id : string|null = null
- $localKey : string|null = null
Return values
MorphManymorphOne()
Define a polymorphic one-to-one relationship.
public
morphOne(string $related, string $name[, string|null $type = null ][, string|null $id = null ][, string|null $localKey = null ]) : MorphOne
Parameters
- $related : string
- $name : string
- $type : string|null = null
- $id : string|null = null
- $localKey : string|null = null
Return values
MorphOnemorphTo()
Define a polymorphic, inverse one-to-one or many relationship.
public
morphTo([string|null $name = null ][, string|null $type = null ][, string|null $id = null ][, string|null $ownerKey = null ]) : MorphTo
Parameters
- $name : string|null = null
- $type : string|null = null
- $id : string|null = null
- $ownerKey : string|null = null
Return values
MorphTomorphToMany()
Define a polymorphic many-to-many relationship.
public
morphToMany(string $related, string $name[, string|null $table = null ][, string|null $foreignPivotKey = null ][, string|null $relatedPivotKey = null ][, string|null $parentKey = null ][, string|null $relatedKey = null ][, bool $inverse = false ]) : MorphToMany
Parameters
- $related : string
- $name : string
- $table : string|null = null
- $foreignPivotKey : string|null = null
- $relatedPivotKey : string|null = null
- $parentKey : string|null = null
- $relatedKey : string|null = null
- $inverse : bool = false
Return values
MorphToManynewCollection()
Create a new Eloquent Collection instance.
public
newCollection([array<string|int, mixed> $models = [] ]) : Collection
Parameters
- $models : array<string|int, mixed> = []
Return values
CollectionnewEloquentBuilder()
Create a new Eloquent query builder for the model.
public
newEloquentBuilder(Builder $query) : Builder|static
Parameters
- $query : Builder
Return values
Builder|staticnewFromBuilder()
Create a new model instance that is existing.
public
newFromBuilder([array<string|int, mixed> $attributes = [] ][, string|null $connection = null ]) : static
Parameters
- $attributes : array<string|int, mixed> = []
- $connection : string|null = null
Return values
staticnewInstance()
Create a new instance of the given model.
public
newInstance([array<string|int, mixed> $attributes = [] ][, bool $exists = false ]) : static
Parameters
- $attributes : array<string|int, mixed> = []
- $exists : bool = false
Return values
staticnewModelQuery()
Get a new query builder that doesn't have any global scopes or eager loading.
public
newModelQuery() : Builder|static
Return values
Builder|staticnewPivot()
Create a new pivot model instance.
public
newPivot(Model $parent, array<string|int, mixed> $attributes, string $table, bool $exists[, string|null $using = null ]) : Pivot
Parameters
- $parent : Model
- $attributes : array<string|int, mixed>
- $table : string
- $exists : bool
- $using : string|null = null
Return values
PivotnewQuery()
Get a new query builder for the model's table.
public
newQuery() : Builder
Return values
BuildernewQueryForRestoration()
Get a new query to restore one or more models by their queueable IDs.
public
newQueryForRestoration(array<string|int, mixed>|int $ids) : Builder
Parameters
- $ids : array<string|int, mixed>|int
Return values
BuildernewQueryWithoutRelationships()
Get a new query builder with no relationships loaded.
public
newQueryWithoutRelationships() : Builder
Return values
BuildernewQueryWithoutScope()
Get a new query instance without a given scope.
public
newQueryWithoutScope(Scope|string $scope) : Builder
Parameters
- $scope : Scope|string
Return values
BuildernewQueryWithoutScopes()
Get a new query builder that doesn't have any global scopes.
public
newQueryWithoutScopes() : Builder|static
Return values
Builder|staticobserve()
Register observers with the model.
public
static observe(object|array<string|int, mixed>|string $classes) : void
Parameters
- $classes : object|array<string|int, mixed>|string
Tags
offsetExists()
Determine if the given attribute exists.
public
offsetExists(mixed $offset) : bool
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
Return values
booloffsetGet()
Get the value for a given offset.
public
offsetGet(mixed $offset) : mixed
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
offsetSet()
Set the value for a given offset.
public
offsetSet(mixed $offset, mixed $value) : void
Parameters
- $offset : mixed
- $value : mixed
Attributes
- #[ReturnTypeWillChange]
offsetUnset()
Unset the value for a given offset.
public
offsetUnset(mixed $offset) : void
Parameters
- $offset : mixed
Attributes
- #[ReturnTypeWillChange]
on()
Begin querying the model on a given connection.
public
static on([string|null $connection = null ]) : Builder
Parameters
- $connection : string|null = null
Return values
Builderonly()
Get a subset of the model's attributes.
public
only(array<string|int, mixed>|mixed $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>|mixed
Return values
array<string|int, mixed>onWriteConnection()
Begin querying the model on the write connection.
public
static onWriteConnection() : Builder
Return values
BuilderoriginalIsEquivalent()
Determine if the new and old values for a given key are equivalent.
public
originalIsEquivalent(string $key) : bool
Parameters
- $key : string
Return values
boolpreventLazyLoading()
Prevent model relationships from being lazy loaded.
public
static preventLazyLoading([bool $value = true ]) : void
Parameters
- $value : bool = true
preventsLazyLoading()
Determine if lazy loading is disabled.
public
static preventsLazyLoading() : bool
Return values
boolpush()
Save the model and all of its relationships.
public
push() : bool
Return values
boolqualifyColumn()
Qualify the given column name by the model's table.
public
qualifyColumn(string $column) : string
Parameters
- $column : string
Return values
stringqualifyColumns()
Qualify the given columns with the model's table.
public
qualifyColumns(array<string|int, mixed> $columns) : array<string|int, mixed>
Parameters
- $columns : array<string|int, mixed>
Return values
array<string|int, mixed>query()
Begin querying the model.
public
static query() : Builder
Return values
Builderrefresh()
Reload the current model instance with fresh attributes from the database.
public
refresh() : $this
Return values
$thisregisterGlobalScopes()
Register the global scopes for this builder instance.
public
registerGlobalScopes(Builder $builder) : Builder
Parameters
- $builder : Builder
Return values
Builderreguard()
Enable the mass assignment restrictions.
public
static reguard() : void
relationLoaded()
Determine if the given relation is loaded.
public
relationLoaded(string $key) : bool
Parameters
- $key : string
Return values
boolrelationsToArray()
Get the model's relationships in array form.
public
relationsToArray() : array<string|int, mixed>
Return values
array<string|int, mixed>removeObservableEvents()
Remove an observable event name.
public
removeObservableEvents(array<string|int, mixed>|mixed $observables) : void
Parameters
- $observables : array<string|int, mixed>|mixed
replicate()
Clone the model into a new, non-existing instance.
public
replicate([array<string|int, mixed>|null $except = null ]) : static
Parameters
- $except : array<string|int, mixed>|null = null
Return values
staticreplicating()
Register a replicating model event with the dispatcher.
public
static replicating(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
resolveChildRouteBinding()
Retrieve the child model for a bound value.
public
resolveChildRouteBinding(string $childType, mixed $value, string|null $field) : Model|null
Parameters
- $childType : string
- $value : mixed
- $field : string|null
Return values
Model|nullresolveConnection()
Resolve a connection instance.
public
static resolveConnection([string|null $connection = null ]) : Connection
Parameters
- $connection : string|null = null
Return values
ConnectionresolveRelationUsing()
Define a dynamic relation resolver.
public
static resolveRelationUsing(string $name, Closure $callback) : void
Parameters
- $name : string
- $callback : Closure
resolveRouteBinding()
Retrieve the model for a bound value.
public
resolveRouteBinding(mixed $value[, string|null $field = null ]) : Model|null
Parameters
- $value : mixed
- $field : string|null = null
Return values
Model|nullresolveRouteBindingQuery()
Retrieve the model for a bound value.
public
resolveRouteBindingQuery(Model|Relation $query, mixed $value[, string|null $field = null ]) : Relation
Parameters
- $query : Model|Relation
- $value : mixed
- $field : string|null = null
Return values
RelationresolveSoftDeletableChildRouteBinding()
Retrieve the child model for a bound value.
public
resolveSoftDeletableChildRouteBinding(string $childType, mixed $value, string|null $field) : Model|null
Parameters
- $childType : string
- $value : mixed
- $field : string|null
Return values
Model|nullresolveSoftDeletableRouteBinding()
Retrieve the model for a bound value.
public
resolveSoftDeletableRouteBinding(mixed $value[, string|null $field = null ]) : Model|null
Parameters
- $value : mixed
- $field : string|null = null
Return values
Model|nullretrieved()
Register a retrieved model event with the dispatcher.
public
static retrieved(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
save()
Save the model to the database.
public
save([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
Return values
boolsaved()
Register a saved model event with the dispatcher.
public
static saved(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
saveOrFail()
Save the model to the database within a transaction.
public
saveOrFail([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
Tags
Return values
boolsaveQuietly()
Save the model to the database without raising any events.
public
saveQuietly([array<string|int, mixed> $options = [] ]) : bool
Parameters
- $options : array<string|int, mixed> = []
Return values
boolsaving()
Register a saving model event with the dispatcher.
public
static saving(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
setAppends()
Set the accessors to append to model arrays.
public
setAppends(array<string|int, mixed> $appends) : $this
Parameters
- $appends : array<string|int, mixed>
Return values
$thissetAttribute()
Set a given attribute on the model.
public
setAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
setConnection()
Set the connection associated with the model.
public
setConnection(string|null $name) : $this
Parameters
- $name : string|null
Return values
$thissetConnectionResolver()
Set the connection resolver instance.
public
static setConnectionResolver(ConnectionResolverInterface $resolver) : void
Parameters
- $resolver : ConnectionResolverInterface
setCreatedAt()
Set the value of the "created at" attribute.
public
setCreatedAt(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thissetDateFormat()
Set the date format used by the model.
public
setDateFormat(string $format) : $this
Parameters
- $format : string
Return values
$thissetEventDispatcher()
Set the event dispatcher instance.
public
static setEventDispatcher(Dispatcher $dispatcher) : void
Parameters
- $dispatcher : Dispatcher
setHidden()
Set the hidden attributes for the model.
public
setHidden(array<string|int, mixed> $hidden) : $this
Parameters
- $hidden : array<string|int, mixed>
Return values
$thissetIncrementing()
Set whether IDs are incrementing.
public
setIncrementing(bool $value) : $this
Parameters
- $value : bool
Return values
$thissetKeyName()
Set the primary key for the model.
public
setKeyName(string $key) : $this
Parameters
- $key : string
Return values
$thissetKeyType()
Set the data type for the primary key.
public
setKeyType(string $type) : $this
Parameters
- $type : string
Return values
$thissetObservableEvents()
Set the observable event names.
public
setObservableEvents(array<string|int, mixed> $observables) : $this
Parameters
- $observables : array<string|int, mixed>
Return values
$thissetPerPage()
Set the number of models to return per page.
public
setPerPage(int $perPage) : $this
Parameters
- $perPage : int
Return values
$thissetRawAttributes()
Set the array of model attributes. No checking is done.
public
setRawAttributes(array<string|int, mixed> $attributes[, bool $sync = false ]) : $this
Parameters
- $attributes : array<string|int, mixed>
- $sync : bool = false
Return values
$thissetRelation()
Set the given relationship on the model.
public
setRelation(string $relation, mixed $value) : $this
Parameters
- $relation : string
- $value : mixed
Return values
$thissetRelations()
Set the entire relations array on the model.
public
setRelations(array<string|int, mixed> $relations) : $this
Parameters
- $relations : array<string|int, mixed>
Return values
$thissetTable()
Set the table associated with the model.
public
setTable(string $table) : $this
Parameters
- $table : string
Return values
$thissetTouchedRelations()
Set the relationships that are touched on save.
public
setTouchedRelations(array<string|int, mixed> $touches) : $this
Parameters
- $touches : array<string|int, mixed>
Return values
$thissetUpdatedAt()
Set the value of the "updated at" attribute.
public
setUpdatedAt(mixed $value) : $this
Parameters
- $value : mixed
Return values
$thissetVisible()
Set the visible attributes for the model.
public
setVisible(array<string|int, mixed> $visible) : $this
Parameters
- $visible : array<string|int, mixed>
Return values
$thissyncChanges()
Sync the changed attributes.
public
syncChanges() : $this
Return values
$thissyncOriginal()
Sync the original attributes with the current.
public
syncOriginal() : $this
Return values
$thissyncOriginalAttribute()
Sync a single original attribute with its current value.
public
syncOriginalAttribute(string $attribute) : $this
Parameters
- $attribute : string
Return values
$thissyncOriginalAttributes()
Sync multiple original attribute with their current values.
public
syncOriginalAttributes(array<string|int, mixed>|string $attributes) : $this
Parameters
- $attributes : array<string|int, mixed>|string
Return values
$thistoArray()
Convert the model instance to an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>toJson()
Convert the model instance to JSON.
public
toJson([int $options = 0 ]) : string
Parameters
- $options : int = 0
Tags
Return values
stringtotallyGuarded()
Determine if the model is totally guarded.
public
totallyGuarded() : bool
Return values
booltouch()
Update the model's update timestamp.
public
touch() : bool
Return values
booltouches()
Determine if the model touches a given relation.
public
touches(string $relation) : bool
Parameters
- $relation : string
Return values
booltouchOwners()
Touch the owning relations of the model.
public
touchOwners() : void
unguard()
Disable all mass assignable restrictions.
public
static unguard([bool $state = true ]) : void
Parameters
- $state : bool = true
unguarded()
Run the given callable while being unguarded.
public
static unguarded(callable $callback) : mixed
Parameters
- $callback : callable
unsetConnectionResolver()
Unset the connection resolver for models.
public
static unsetConnectionResolver() : void
unsetEventDispatcher()
Unset the event dispatcher for models.
public
static unsetEventDispatcher() : void
unsetRelation()
Unset a loaded relationship.
public
unsetRelation(string $relation) : $this
Parameters
- $relation : string
Return values
$thisunsetRelations()
Unset all the loaded relations for the instance.
public
unsetRelations() : $this
Return values
$thisupdate()
Update the model in the database.
public
update([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $attributes : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
Return values
boolupdated()
Register an updated model event with the dispatcher.
public
static updated(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
updateOrFail()
Update the model in the database within a transaction.
public
updateOrFail([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $attributes : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
Tags
Return values
boolupdateQuietly()
Update the model in the database without raising any events.
public
updateQuietly([array<string|int, mixed> $attributes = [] ][, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $attributes : array<string|int, mixed> = []
- $options : array<string|int, mixed> = []
Return values
boolupdateTimestamps()
Update the creation and update timestamps.
public
updateTimestamps() : void
updating()
Register an updating model event with the dispatcher.
public
static updating(QueuedClosure|Closure|string $callback) : void
Parameters
- $callback : QueuedClosure|Closure|string
usesTimestamps()
Determine if the model uses timestamps.
public
usesTimestamps() : bool
Return values
boolwasChanged()
Determine if the model or any of the given attribute(s) have been modified.
public
wasChanged([array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
- $attributes : array<string|int, mixed>|string|null = null
Return values
boolwith()
Begin querying a model with eager loading.
public
static with(array<string|int, mixed>|string $relations) : Builder
Parameters
- $relations : array<string|int, mixed>|string
Return values
BuilderwithoutBroadcasting()
Execute a callback without broadcasting any model events for all model types.
public
static withoutBroadcasting(callable $callback) : mixed
Parameters
- $callback : callable
withoutEvents()
Execute a callback without firing any model events for any model type.
public
static withoutEvents(callable $callback) : mixed
Parameters
- $callback : callable
withoutRelations()
Duplicate the instance and unset all the loaded relations.
public
withoutRelations() : $this
Return values
$thiswithoutTouching()
Disables relationship model touching for the current class during given callback scope.
public
static withoutTouching(callable $callback) : void
Parameters
- $callback : callable
withoutTouchingOn()
Disables relationship model touching for the given model classes during given callback scope.
public
static withoutTouchingOn(array<string|int, mixed> $models, callable $callback) : void
Parameters
- $models : array<string|int, mixed>
- $callback : callable
addCastAttributesToArray()
Add the casted attributes to the attributes array.
protected
addCastAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
- $mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>addDateAttributesToArray()
Add the date attributes to the attributes array.
protected
addDateAttributesToArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>addMutatedAttributesToArray()
Add the mutated attributes to the attributes array.
protected
addMutatedAttributesToArray(array<string|int, mixed> $attributes, array<string|int, mixed> $mutatedAttributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
- $mutatedAttributes : array<string|int, mixed>
Return values
array<string|int, mixed>asDate()
Return a timestamp as DateTime object with time set to 00:00:00.
protected
asDate(mixed $value) : Carbon
Parameters
- $value : mixed
Return values
CarbonasDateTime()
Return a timestamp as DateTime object.
protected
asDateTime(mixed $value) : Carbon
Parameters
- $value : mixed
Return values
CarbonasDecimal()
Return a decimal as string.
protected
asDecimal(float $value, int $decimals) : string
Parameters
- $value : float
- $decimals : int
Return values
stringasJson()
Encode the given value as JSON.
protected
asJson(mixed $value) : string
Parameters
- $value : mixed
Return values
stringasTimestamp()
Return a timestamp as unix timestamp.
protected
asTimestamp(mixed $value) : int
Parameters
- $value : mixed
Return values
intboot()
Bootstrap the model and its traits.
protected
static boot() : void
booted()
Perform any actions required after the model boots.
protected
static booted() : void
bootIfNotBooted()
Check if the model needs to be booted and if so, do it.
protected
bootIfNotBooted() : void
booting()
Perform any actions required before the model boots.
protected
static booting() : void
bootTraits()
Boot all of the bootable traits on the model.
protected
static bootTraits() : void
castAttribute()
Cast an attribute to a native PHP type.
protected
castAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
castAttributeAsEncryptedString()
Cast the given attribute to an encrypted string.
protected
castAttributeAsEncryptedString(string $key, mixed $value) : string
Parameters
- $key : string
- $value : mixed
Return values
stringcastAttributeAsJson()
Cast the given attribute to JSON.
protected
castAttributeAsJson(string $key, mixed $value) : string
Parameters
- $key : string
- $value : mixed
Return values
stringdecrement()
Decrement a column's value by a given amount.
protected
decrement(string $column[, float|int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
- $column : string
- $amount : float|int = 1
- $extra : array<string|int, mixed> = []
Return values
intdeviateClassCastableAttribute()
Increment or decrement the given attribute using the custom cast class.
protected
deviateClassCastableAttribute(string $method, string $key, mixed $value) : mixed
Parameters
- $method : string
- $key : string
- $value : mixed
fillableFromArray()
Get the fillable attributes of a given array.
protected
fillableFromArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>filterModelEventResults()
Filter the model event results.
protected
filterModelEventResults(mixed $result) : mixed
Parameters
- $result : mixed
finishSave()
Perform any actions that are necessary after the model is saved.
protected
finishSave(array<string|int, mixed> $options) : void
Parameters
- $options : array<string|int, mixed>
fireCustomModelEvent()
Fire a custom model event for the given event.
protected
fireCustomModelEvent(string $event, string $method) : mixed|null
Parameters
- $event : string
- $method : string
Return values
mixed|nullfireModelEvent()
Fire the given event for the model.
protected
fireModelEvent(string $event[, bool $halt = true ]) : mixed
Parameters
- $event : string
- $halt : bool = true
forwardCallTo()
Forward a method call to the given object.
protected
forwardCallTo(mixed $object, string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $object : mixed
- $method : string
- $parameters : array<string|int, mixed>
Tags
forwardDecoratedCallTo()
Forward a method call to the given object, returning $this if the forwarded call returned itself.
protected
forwardDecoratedCallTo(mixed $object, string $method, array<string|int, mixed> $parameters) : mixed
Parameters
- $object : mixed
- $method : string
- $parameters : array<string|int, mixed>
Tags
getArrayableAppends()
Get all of the appendable values that are arrayable.
protected
getArrayableAppends() : array<string|int, mixed>
Return values
array<string|int, mixed>getArrayableAttributes()
Get an attribute array of all arrayable attributes.
protected
getArrayableAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed>getArrayableItems()
Get an attribute array of all arrayable values.
protected
getArrayableItems(array<string|int, mixed> $values) : array<string|int, mixed>
Parameters
- $values : array<string|int, mixed>
Return values
array<string|int, mixed>getArrayableRelations()
Get an attribute array of all arrayable relations.
protected
getArrayableRelations() : array<string|int, mixed>
Return values
array<string|int, mixed>getArrayAttributeByKey()
Get an array attribute or return an empty array if it is not set.
protected
getArrayAttributeByKey(string $key) : array<string|int, mixed>
Parameters
- $key : string
Return values
array<string|int, mixed>getArrayAttributeWithValue()
Get an array attribute with the given key and value set.
protected
getArrayAttributeWithValue(string $path, string $key, mixed $value) : $this
Parameters
- $path : string
- $key : string
- $value : mixed
Return values
$thisgetAttributeFromArray()
Get an attribute from the $attributes array.
protected
getAttributeFromArray(string $key) : mixed
Parameters
- $key : string
getAttributeMarkedMutatorMethods()
Get all of the "Attribute" return typed attribute mutator methods.
protected
static getAttributeMarkedMutatorMethods(mixed $class) : array<string|int, mixed>
Parameters
- $class : mixed
Return values
array<string|int, mixed>getAttributesForInsert()
Get all of the current attributes on the model for an insert operation.
protected
getAttributesForInsert() : array<string|int, mixed>
Return values
array<string|int, mixed>getCastType()
Get the type of cast for a model attribute.
protected
getCastType(string $key) : string
Parameters
- $key : string
Return values
stringgetClassCastableAttributeValue()
Cast the given attribute using a custom cast class.
protected
getClassCastableAttributeValue(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
getEnumCastableAttributeValue()
Cast the given attribute to an enum.
protected
getEnumCastableAttributeValue(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
getKeyForSaveQuery()
Get the primary key value for a save query.
protected
getKeyForSaveQuery() : mixed
getKeyForSelectQuery()
Get the primary key value for a select query.
protected
getKeyForSelectQuery() : mixed
getMorphs()
Get the polymorphic relationship columns.
protected
getMorphs(string $name, string $type, string $id) : array<string|int, mixed>
Parameters
- $name : string
- $type : string
- $id : string
Return values
array<string|int, mixed>getMutatorMethods()
Get all of the attribute mutator methods.
protected
static getMutatorMethods(mixed $class) : array<string|int, mixed>
Parameters
- $class : mixed
Return values
array<string|int, mixed>getOriginalWithoutRewindingModel()
Get the model's original attribute values.
protected
getOriginalWithoutRewindingModel([string|null $key = null ][, mixed $default = null ]) : mixed|array<string|int, mixed>
Parameters
- $key : string|null = null
- $default : mixed = null
Return values
mixed|array<string|int, mixed>getRelationshipFromMethod()
Get a relationship value from a method.
protected
getRelationshipFromMethod(string $method) : mixed
Parameters
- $method : string
Tags
guessBelongsToManyRelation()
Get the relationship name of the belongsToMany relationship.
protected
guessBelongsToManyRelation() : string|null
Return values
string|nullguessBelongsToRelation()
Guess the "belongs to" relationship name.
protected
guessBelongsToRelation() : string
Return values
stringhandleLazyLoadingViolation()
Handle a lazy loading violation.
protected
handleLazyLoadingViolation(string $key) : mixed
Parameters
- $key : string
hasChanges()
Determine if any of the given attributes were changed.
protected
hasChanges(array<string|int, mixed> $changes[, array<string|int, mixed>|string|null $attributes = null ]) : bool
Parameters
- $changes : array<string|int, mixed>
- $attributes : array<string|int, mixed>|string|null = null
Return values
boolincrement()
Increment a column's value by a given amount.
protected
increment(string $column[, float|int $amount = 1 ][, array<string|int, mixed> $extra = [] ]) : int
Parameters
- $column : string
- $amount : float|int = 1
- $extra : array<string|int, mixed> = []
Return values
intincrementOrDecrement()
Run the increment or decrement method on the model.
protected
incrementOrDecrement(string $column, float|int $amount, array<string|int, mixed> $extra, string $method) : int
Parameters
- $column : string
- $amount : float|int
- $extra : array<string|int, mixed>
- $method : string
Return values
intinitializeTraits()
Initialize any initializable traits on the model.
protected
initializeTraits() : void
insertAndSetId()
Insert the given attributes and set the ID on the model.
protected
insertAndSetId(Builder $query, array<string|int, mixed> $attributes) : void
Parameters
- $query : Builder
- $attributes : array<string|int, mixed>
isClassCastable()
Determine if the given key is cast using a custom class.
protected
isClassCastable(string $key) : bool
Parameters
- $key : string
Tags
Return values
boolisClassDeviable()
Determine if the key is deviable using a custom class.
protected
isClassDeviable(string $key) : bool
Parameters
- $key : string
Tags
Return values
boolisClassSerializable()
Determine if the key is serializable using a custom class.
protected
isClassSerializable(string $key) : bool
Parameters
- $key : string
Tags
Return values
boolisCustomDateTimeCast()
Determine if the cast type is a custom date time cast.
protected
isCustomDateTimeCast(string $cast) : bool
Parameters
- $cast : string
Return values
boolisDateAttribute()
Determine if the given attribute is a date or date castable.
protected
isDateAttribute(string $key) : bool
Parameters
- $key : string
Return values
boolisDateCastable()
Determine whether a value is Date / DateTime castable for inbound manipulation.
protected
isDateCastable(string $key) : bool
Parameters
- $key : string
Return values
boolisDateCastableWithCustomFormat()
Determine whether a value is Date / DateTime custom-castable for inbound manipulation.
protected
isDateCastableWithCustomFormat(string $key) : bool
Parameters
- $key : string
Return values
boolisDecimalCast()
Determine if the cast type is a decimal cast.
protected
isDecimalCast(string $cast) : bool
Parameters
- $cast : string
Return values
boolisEncryptedCastable()
Determine whether a value is an encrypted castable for inbound manipulation.
protected
isEncryptedCastable(string $key) : bool
Parameters
- $key : string
Return values
boolisEnumCastable()
Determine if the given key is cast using an enum.
protected
isEnumCastable(string $key) : bool
Parameters
- $key : string
Return values
boolisGuardableColumn()
Determine if the given column is a valid, guardable column.
protected
isGuardableColumn(string $key) : bool
Parameters
- $key : string
Return values
boolisImmutableCustomDateTimeCast()
Determine if the cast type is an immutable custom date time cast.
protected
isImmutableCustomDateTimeCast(string $cast) : bool
Parameters
- $cast : string
Return values
boolisJsonCastable()
Determine whether a value is JSON castable for inbound manipulation.
protected
isJsonCastable(string $key) : bool
Parameters
- $key : string
Return values
boolisStandardDateFormat()
Determine if the given value is a standard date format.
protected
isStandardDateFormat(string $value) : bool
Parameters
- $value : string
Return values
boolmergeAttributesFromAttributeCasts()
Merge the cast class attributes back into the model.
protected
mergeAttributesFromAttributeCasts() : void
mergeAttributesFromCachedCasts()
Merge the cast class and attribute cast attributes back into the model.
protected
mergeAttributesFromCachedCasts() : void
mergeAttributesFromClassCasts()
Merge the cast class attributes back into the model.
protected
mergeAttributesFromClassCasts() : void
morphEagerTo()
Define a polymorphic, inverse one-to-one or many relationship.
protected
morphEagerTo(string $name, string $type, string $id, string $ownerKey) : MorphTo
Parameters
- $name : string
- $type : string
- $id : string
- $ownerKey : string
Return values
MorphTomorphInstanceTo()
Define a polymorphic, inverse one-to-one or many relationship.
protected
morphInstanceTo(string $target, string $name, string $type, string $id, string $ownerKey) : MorphTo
Parameters
- $target : string
- $name : string
- $type : string
- $id : string
- $ownerKey : string
Return values
MorphTomutateAttribute()
Get the value of an attribute using its mutator.
protected
mutateAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
mutateAttributeForArray()
Get the value of an attribute using its mutator for array conversion.
protected
mutateAttributeForArray(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
mutateAttributeMarkedAttribute()
Get the value of an "Attribute" return type marked attribute using its mutator.
protected
mutateAttributeMarkedAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
newBaseQueryBuilder()
Get a new query builder instance for the connection.
protected
newBaseQueryBuilder() : Builder
Return values
BuildernewBelongsTo()
Instantiate a new BelongsTo relationship.
protected
newBelongsTo(Builder $query, Model $child, string $foreignKey, string $ownerKey, string $relation) : BelongsTo
Parameters
Return values
BelongsTonewBelongsToMany()
Instantiate a new BelongsToMany relationship.
protected
newBelongsToMany(Builder $query, Model $parent, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string|null $relationName = null ]) : BelongsToMany
Parameters
- $query : Builder
- $parent : Model
- $table : string
- $foreignPivotKey : string
- $relatedPivotKey : string
- $parentKey : string
- $relatedKey : string
- $relationName : string|null = null
Return values
BelongsToManynewHasMany()
Instantiate a new HasMany relationship.
protected
newHasMany(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasMany
Parameters
Return values
HasManynewHasManyThrough()
Instantiate a new HasManyThrough relationship.
protected
newHasManyThrough(Builder $query, Model $farParent, Model $throughParent, string $firstKey, string $secondKey, string $localKey, string $secondLocalKey) : HasManyThrough
Parameters
- $query : Builder
- $farParent : Model
- $throughParent : Model
- $firstKey : string
- $secondKey : string
- $localKey : string
- $secondLocalKey : string
Return values
HasManyThroughnewHasOne()
Instantiate a new HasOne relationship.
protected
newHasOne(Builder $query, Model $parent, string $foreignKey, string $localKey) : HasOne
Parameters
Return values
HasOnenewHasOneThrough()
Instantiate a new HasOneThrough relationship.
protected
newHasOneThrough(Builder $query, Model $farParent, Model $throughParent, string $firstKey, string $secondKey, string $localKey, string $secondLocalKey) : HasOneThrough
Parameters
- $query : Builder
- $farParent : Model
- $throughParent : Model
- $firstKey : string
- $secondKey : string
- $localKey : string
- $secondLocalKey : string
Return values
HasOneThroughnewMorphMany()
Instantiate a new MorphMany relationship.
protected
newMorphMany(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphMany
Parameters
Return values
MorphManynewMorphOne()
Instantiate a new MorphOne relationship.
protected
newMorphOne(Builder $query, Model $parent, string $type, string $id, string $localKey) : MorphOne
Parameters
Return values
MorphOnenewMorphTo()
Instantiate a new MorphTo relationship.
protected
newMorphTo(Builder $query, Model $parent, string $foreignKey, string $ownerKey, string $type, string $relation) : MorphTo
Parameters
- $query : Builder
- $parent : Model
- $foreignKey : string
- $ownerKey : string
- $type : string
- $relation : string
Return values
MorphTonewMorphToMany()
Instantiate a new MorphToMany relationship.
protected
newMorphToMany(Builder $query, Model $parent, string $name, string $table, string $foreignPivotKey, string $relatedPivotKey, string $parentKey, string $relatedKey[, string|null $relationName = null ][, bool $inverse = false ]) : MorphToMany
Parameters
- $query : Builder
- $parent : Model
- $name : string
- $table : string
- $foreignPivotKey : string
- $relatedPivotKey : string
- $parentKey : string
- $relatedKey : string
- $relationName : string|null = null
- $inverse : bool = false
Return values
MorphToManynewRelatedInstance()
Create a new model instance for a related model.
protected
newRelatedInstance(string $class) : mixed
Parameters
- $class : string
normalizeCastClassResponse()
Normalize the response from a custom class caster.
protected
normalizeCastClassResponse(string $key, mixed $value) : array<string|int, mixed>
Parameters
- $key : string
- $value : mixed
Return values
array<string|int, mixed>parseCasterClass()
Parse the given caster class, removing any arguments.
protected
parseCasterClass(string $class) : string
Parameters
- $class : string
Return values
stringperformDeleteOnModel()
Perform the actual delete query on this model instance.
protected
performDeleteOnModel() : void
performInsert()
Perform a model insert operation.
protected
performInsert(Builder $query) : bool
Parameters
- $query : Builder
Return values
boolperformUpdate()
Perform a model update operation.
protected
performUpdate(Builder $query) : bool
Parameters
- $query : Builder
Return values
boolregisterModelEvent()
Register a model event with the dispatcher.
protected
static registerModelEvent(string $event, QueuedClosure|Closure|string $callback) : void
Parameters
- $event : string
- $callback : QueuedClosure|Closure|string
registerObserver()
Register a single observer with the model.
protected
registerObserver(object|string $class) : void
Parameters
- $class : object|string
Tags
resolveCasterClass()
Resolve the custom caster class for a given key.
protected
resolveCasterClass(string $key) : mixed
Parameters
- $key : string
resolveChildRouteBindingQuery()
Retrieve the child model query for a bound value.
protected
resolveChildRouteBindingQuery(string $childType, mixed $value, string|null $field) : Relation
Parameters
- $childType : string
- $value : mixed
- $field : string|null
Return values
RelationserializeClassCastableAttribute()
Serialize the given attribute using the custom cast class.
protected
serializeClassCastableAttribute(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
serializeDate()
Prepare a date for array / JSON serialization.
protected
serializeDate(DateTimeInterface $date) : string
Parameters
- $date : DateTimeInterface
Return values
stringsetAttributeMarkedMutatedAttributeValue()
Set the value of a "Attribute" return type marked attribute using its mutator.
protected
setAttributeMarkedMutatedAttributeValue(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
setClassCastableAttribute()
Set the value of a class castable attribute.
protected
setClassCastableAttribute(string $key, mixed $value) : void
Parameters
- $key : string
- $value : mixed
setEnumCastableAttribute()
Set the value of an enum castable attribute.
protected
setEnumCastableAttribute(string $key, BackedEnum $value) : void
Parameters
- $key : string
- $value : BackedEnum
setKeysForSaveQuery()
Set the keys for a save update query.
protected
setKeysForSaveQuery(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuildersetKeysForSelectQuery()
Set the keys for a select query.
protected
setKeysForSelectQuery(Builder $query) : Builder
Parameters
- $query : Builder
Return values
BuildersetMutatedAttributeValue()
Set the value of an attribute using its mutator.
protected
setMutatedAttributeValue(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
throwBadMethodCallException()
Throw a bad method call exception for the given method.
protected
static throwBadMethodCallException(string $method) : void
Parameters
- $method : string
Tags
transformModelValue()
Transform a raw model value using mutators, casts, etc.
protected
transformModelValue(string $key, mixed $value) : mixed
Parameters
- $key : string
- $value : mixed
resolveObserverClassName()
Resolve the observer's class name from an object or string.
private
resolveObserverClassName(object|string $class) : string
Parameters
- $class : object|string