Methods |
public
|
__construct(array $attributes = []): void
Create a new Eloquent model instance.
Create a new Eloquent model instance.
Overriden by
|
#
|
public
static
|
clearBootedModels(): void
Clear the list of booted models so they will be re-booted.
Clear the list of booted models so they will be re-booted.
|
#
|
public
static
|
withoutTouching(callable $callback): void
Disables relationship model touching for the current class during given callback scope.
Disables relationship model touching for the current class during given callback scope.
|
#
|
public
static
|
withoutTouchingOn(array $models, callable $callback): void
Disables relationship model touching for the given model classes during given callback scope.
Disables relationship model touching for the given model classes during given callback scope.
|
#
|
public
static
|
isIgnoringTouch(string|null $class = null): bool
Determine if the given model is ignoring touches.
Determine if the given model is ignoring touches.
|
#
|
public
static
|
preventLazyLoading(bool $value = true): void
Prevent model relationships from being lazy loaded.
Prevent model relationships from being lazy loaded.
|
#
|
public
static
|
handleLazyLoadingViolationUsing(callable|null $callback): void
Register a callback that is responsible for handling lazy loading violations.
Register a callback that is responsible for handling lazy loading violations.
|
#
|
public
static
|
withoutBroadcasting(callable $callback): mixed
Execute a callback without broadcasting any model events for all model types.
Execute a callback without broadcasting any model events for all model types.
|
#
|
public
|
fill(array $attributes): $this
Fill the model with an array of attributes.
Fill the model with an array of attributes.
Throws
|
#
|
public
|
forceFill(array $attributes): $this
Fill the model with an array of attributes. Force mass assignment.
Fill the model with an array of attributes. Force mass assignment.
|
#
|
public
|
qualifyColumn(string $column): string
Qualify the given column name by the model's table.
Qualify the given column name by the model's table.
|
#
|
public
|
qualifyColumns(array $columns): array
Qualify the given columns with the model's table.
Qualify the given columns with the model's table.
|
#
|
public
|
newInstance(array $attributes = [], bool $exists = false): static
Create a new instance of the given model.
Create a new instance of the given model.
|
#
|
public
|
newFromBuilder(array $attributes = [], string|null $connection = null): static
Create a new model instance that is existing.
Create a new model instance that is existing.
|
#
|
public
static
|
on(string|null $connection = null): Builder
Begin querying the model on a given connection.
Begin querying the model on a given connection.
|
#
|
public
static
|
onWriteConnection(): Builder
Begin querying the model on the write connection.
Begin querying the model on the write connection.
|
#
|
public
static
|
all(array|mixed $columns = ['*']): Collection|static[]
Get all of the models from the database.
Get all of the models from the database.
|
#
|
public
static
|
with(array|string $relations): Builder
Begin querying a model with eager loading.
Begin querying a model with eager loading.
|
#
|
public
|
load(array|string $relations): $this
Eager load relations on the model.
Eager load relations on the model.
|
#
|
public
|
loadMorph(string $relation, array $relations): $this
Eager load relationships on the polymorphic relation of a model.
Eager load relationships on the polymorphic relation of a model.
|
#
|
public
|
loadMissing(array|string $relations): $this
Eager load relations on the model if they are not already eager loaded.
Eager load relations on the model if they are not already eager loaded.
|
#
|
public
|
loadAggregate(array|string $relations, string $column, string $function = null): $this
Eager load relation's column aggregations on the model.
Eager load relation's column aggregations on the model.
|
#
|
public
|
loadCount(array|string $relations): $this
Eager load relation counts on the model.
Eager load relation counts on the model.
|
#
|
public
|
loadMax(array|string $relations, string $column): $this
Eager load relation max column values on the model.
Eager load relation max column values on the model.
|
#
|
public
|
loadMin(array|string $relations, string $column): $this
Eager load relation min column values on the model.
Eager load relation min column values on the model.
|
#
|
public
|
loadSum(array|string $relations, string $column): $this
Eager load relation's column summations on the model.
Eager load relation's column summations on the model.
|
#
|
public
|
loadAvg(array|string $relations, string $column): $this
Eager load relation average column values on the model.
Eager load relation average column values on the model.
|
#
|
public
|
loadExists(array|string $relations): $this
Eager load related model existence values on the model.
Eager load related model existence values on the model.
|
#
|
public
|
loadMorphAggregate(string $relation, array $relations, string $column, string $function = null): $this
Eager load relationship column aggregation on the polymorphic relation of a model.
Eager load relationship column aggregation on the polymorphic relation of a model.
|
#
|
public
|
loadMorphCount(string $relation, array $relations): $this
Eager load relationship counts on the polymorphic relation of a model.
Eager load relationship counts on the polymorphic relation of a model.
|
#
|
public
|
loadMorphMax(string $relation, array $relations, string $column): $this
Eager load relationship max column values on the polymorphic relation of a model.
Eager load relationship max column values on the polymorphic relation of a model.
|
#
|
public
|
loadMorphMin(string $relation, array $relations, string $column): $this
Eager load relationship min column values on the polymorphic relation of a model.
Eager load relationship min column values on the polymorphic relation of a model.
|
#
|
public
|
loadMorphSum(string $relation, array $relations, string $column): $this
Eager load relationship column summations on the polymorphic relation of a model.
Eager load relationship column summations on the polymorphic relation of a model.
|
#
|
public
|
loadMorphAvg(string $relation, array $relations, string $column): $this
Eager load relationship average column values on the polymorphic relation of a model.
Eager load relationship average column values on the polymorphic relation of a model.
|
#
|
public
|
update(array $attributes = [], array $options = []): bool
Update the model in the database.
Update the model in the database.
|
#
|
public
|
updateOrFail(array $attributes = [], array $options = []): bool
Update the model in the database within a transaction.
Update the model in the database within a transaction.
Throws
|
#
|
public
|
updateQuietly(array $attributes = [], array $options = []): bool
Update the model in the database without raising any events.
Update the model in the database without raising any events.
|
#
|
public
|
push(): bool
Save the model and all of its relationships.
Save the model and all of its relationships.
|
#
|
public
|
saveQuietly(array $options = []): bool
Save the model to the database without raising any events.
Save the model to the database without raising any events.
|
#
|
public
|
save(array $options = []): bool
Save the model to the database.
Save the model to the database.
Overriden by
|
#
|
public
|
saveOrFail(array $options = []): bool
Save the model to the database within a transaction.
Save the model to the database within a transaction.
Throws
|
#
|
public
static
|
destroy(Collection|array|int|string $ids): int
Destroy the models for the given IDs.
Destroy the models for the given IDs.
|
#
|
public
|
delete(): bool|null
Delete the model from the database.
Delete the model from the database.
Throws
|
#
|
public
|
deleteOrFail(): bool|null
Delete the model from the database within a transaction.
Delete the model from the database within a transaction.
Throws
|
#
|
public
|
forceDelete(): bool|null
Force a hard delete on a soft deleted model.
Force a hard delete on a soft deleted model.
This method protects developers from running forceDelete when the trait is missing.
|
#
|
public
static
|
query(): Builder
Begin querying the model.
Begin querying the model.
|
#
|
public
|
newQuery(): Builder
Get a new query builder for the model's table.
Get a new query builder for the model's table.
|
#
|
public
|
newModelQuery(): Builder|static
Get a new query builder that doesn't have any global scopes or eager loading.
Get a new query builder that doesn't have any global scopes or eager loading.
|
#
|
public
|
newQueryWithoutRelationships(): Builder
Get a new query builder with no relationships loaded.
Get a new query builder with no relationships loaded.
|
#
|
public
|
registerGlobalScopes(Builder $builder): Builder
Register the global scopes for this builder instance.
Register the global scopes for this builder instance.
|
#
|
public
|
newQueryWithoutScopes(): Builder|static
Get a new query builder that doesn't have any global scopes.
Get a new query builder that doesn't have any global scopes.
|
#
|
public
|
newQueryWithoutScope(Scope|string $scope): Builder
Get a new query instance without a given scope.
Get a new query instance without a given scope.
|
#
|
public
|
newQueryForRestoration(array|int $ids): Builder
Get a new query to restore one or more models by their queueable IDs.
Get a new query to restore one or more models by their queueable IDs.
|
#
|
public
|
newEloquentBuilder(Builder $query): Builder|static
Create a new Eloquent query builder for the model.
Create a new Eloquent query builder for the model.
|
#
|
public
|
newCollection(array $models = []): Collection
Create a new Eloquent Collection instance.
Create a new Eloquent Collection instance.
|
#
|
public
|
newPivot(Model $parent, array $attributes, string $table, bool $exists, string|null $using = null): Pivot
Create a new pivot model instance.
Create a new pivot model instance.
|
#
|
public
|
hasNamedScope(string $scope): bool
Determine if the model has a given scope.
Determine if the model has a given scope.
|
#
|
public
|
callNamedScope(string $scope, array $parameters = []): mixed
Apply the given named scope if possible.
Apply the given named scope if possible.
|
#
|
public
|
toArray(): array
Convert the model instance to an array.
Convert the model instance to an array.
Implements
|
#
|
public
|
toJson(int $options = 0): string
Convert the model instance to JSON.
Convert the model instance to JSON.
Throws
Implements
|
#
|
public
|
jsonSerialize(): array
Convert the object into something JSON serializable.
Convert the object into something JSON serializable.
Implements
|
#
|
public
|
fresh(array|string $with = []): static|null
Reload a fresh model instance from the database.
Reload a fresh model instance from the database.
|
#
|
public
|
refresh(): $this
Reload the current model instance with fresh attributes from the database.
Reload the current model instance with fresh attributes from the database.
|
#
|
public
|
replicate(array|null $except = null): static
Clone the model into a new, non-existing instance.
Clone the model into a new, non-existing instance.
|
#
|
public
|
is(Model|null $model): bool
Determine if two models have the same ID and belong to the same table.
Determine if two models have the same ID and belong to the same table.
|
#
|
public
|
isNot(Model|null $model): bool
Determine if two models are not the same.
Determine if two models are not the same.
|
#
|
public
|
getConnection(): Connection
Get the database connection for the model.
Get the database connection for the model.
|
#
|
public
|
getConnectionName(): string|null
Get the current connection name for the model.
Get the current connection name for the model.
|
#
|
public
|
setConnection(string|null $name): $this
Set the connection associated with the model.
Set the connection associated with the model.
|
#
|
public
static
|
resolveConnection(string|null $connection = null): Connection
Resolve a connection instance.
Resolve a connection instance.
|
#
|
public
static
|
getConnectionResolver(): ConnectionResolverInterface
Get the connection resolver instance.
Get the connection resolver instance.
|
#
|
public
static
|
setConnectionResolver(ConnectionResolverInterface $resolver): void
Set the connection resolver instance.
Set the connection resolver instance.
|
#
|
public
static
|
unsetConnectionResolver(): void
Unset the connection resolver for models.
Unset the connection resolver for models.
|
#
|
public
|
getTable(): string
Get the table associated with the model.
Get the table associated with the model.
|
#
|
public
|
setTable(string $table): $this
Set the table associated with the model.
Set the table associated with the model.
|
#
|
public
|
getKeyName(): string
Get the primary key for the model.
Get the primary key for the model.
|
#
|
public
|
setKeyName(string $key): $this
Set the primary key for the model.
Set the primary key for the model.
|
#
|
public
|
getQualifiedKeyName(): string
Get the table qualified key name.
Get the table qualified key name.
|
#
|
public
|
getKeyType(): string
Get the auto-incrementing key type.
Get the auto-incrementing key type.
|
#
|
public
|
setKeyType(string $type): $this
Set the data type for the primary key.
Set the data type for the primary key.
|
#
|
public
|
getIncrementing(): bool
Get the value indicating whether the IDs are incrementing.
Get the value indicating whether the IDs are incrementing.
|
#
|
public
|
setIncrementing(bool $value): $this
Set whether IDs are incrementing.
Set whether IDs are incrementing.
|
#
|
public
|
getKey(): mixed
Get the value of the model's primary key.
Get the value of the model's primary key.
|
#
|
public
|
getQueueableId(): mixed
Get the queueable identity for the entity.
Get the queueable identity for the entity.
Implements
|
#
|
public
|
getQueueableRelations(): array
Get the queueable relationships for the entity.
Get the queueable relationships for the entity.
Implements
|
#
|
public
|
getQueueableConnection(): string|null
Get the queueable connection for the entity.
Get the queueable connection for the entity.
Implements
|
#
|
public
|
getRouteKey(): mixed
Get the value of the model's route key.
Get the value of the model's route key.
Implements
|
#
|
public
|
getRouteKeyName(): string
Get the route key for the model.
Get the route key for the model.
Implements
|
#
|
public
|
resolveRouteBinding(mixed $value, string|null $field = null): Model|null
Retrieve the model for a bound value.
Retrieve the model for a bound value.
Implements
|
#
|
public
|
resolveSoftDeletableRouteBinding(mixed $value, string|null $field = null): Model|null
Retrieve the model for a bound value.
Retrieve the model for a bound value.
|
#
|
public
|
resolveChildRouteBinding(string $childType, mixed $value, string|null $field): Model|null
Retrieve the child model for a bound value.
Retrieve the child model for a bound value.
Implements
|
#
|
public
|
resolveSoftDeletableChildRouteBinding(string $childType, mixed $value, string|null $field): Model|null
Retrieve the child model for a bound value.
Retrieve the child model for a bound value.
|
#
|
public
|
resolveRouteBindingQuery(Model|Relation $query, mixed $value, string|null $field = null): Relation
Retrieve the model for a bound value.
Retrieve the model for a bound value.
|
#
|
public
|
getForeignKey(): string
Get the default foreign key name for the model.
Get the default foreign key name for the model.
|
#
|
public
|
getPerPage(): int
Get the number of models to return per page.
Get the number of models to return per page.
|
#
|
public
|
setPerPage(int $perPage): $this
Set the number of models to return per page.
Set the number of models to return per page.
|
#
|
public
static
|
preventsLazyLoading(): bool
Determine if lazy loading is disabled.
Determine if lazy loading is disabled.
|
#
|
public
|
broadcastChannelRoute(): string
Get the broadcast channel route definition that is associated with the given entity.
Get the broadcast channel route definition that is associated with the given entity.
Implements
|
#
|
public
|
broadcastChannel(): string
Get the broadcast channel name that is associated with the given entity.
Get the broadcast channel name that is associated with the given entity.
Implements
|
#
|
public
|
__get(string $key): mixed
Dynamically retrieve attributes on the model.
Dynamically retrieve attributes on the model.
Overriden by
|
#
|
public
|
__set(string $key, mixed $value): void
Dynamically set attributes on the model.
Dynamically set attributes on the model.
Overriden by
|
#
|
public
|
offsetExists(mixed $offset): bool
Determine if the given attribute exists.
Determine if the given attribute exists.
Implements
|
#
|
public
|
offsetGet(mixed $offset): mixed
Get the value for a given offset.
Get the value for a given offset.
Implements
|
#
|
public
|
offsetSet(mixed $offset, mixed $value): void
Set the value for a given offset.
Set the value for a given offset.
Implements
|
#
|
public
|
offsetUnset(mixed $offset): void
Unset the value for a given offset.
Unset the value for a given offset.
Implements
|
#
|
public
|
__isset(string $key): bool
Determine if an attribute or relation exists on the model.
Determine if an attribute or relation exists on the model.
Overriden by
|
#
|
public
|
__unset(string $key): void
Unset an attribute on the model.
Unset an attribute on the model.
Overriden by
|
#
|
public
|
__call(string $method, array $parameters): mixed
Handle dynamic method calls into the model.
Handle dynamic method calls into the model.
|
#
|
public
static
|
__callStatic(string $method, array $parameters): mixed
Handle dynamic static method calls into the model.
Handle dynamic static method calls into the model.
|
#
|
public
|
__toString(): string
Convert the model to its string representation.
Convert the model to its string representation.
|
#
|
public
|
escapeWhenCastingToString(bool $escape = true): $this
Indicate that the object's string representation should be escaped when __toString is invoked.
Indicate that the object's string representation should be escaped when __toString is invoked.
Implements
|
#
|
public
|
__sleep(): array
Prepare the object for serialization.
Prepare the object for serialization.
|
#
|
public
|
__wakeup(): void
When a model is being unserialized, check if it needs to be booted.
When a model is being unserialized, check if it needs to be booted.
|
#
|