Methods |
public
|
__construct(Builder $query, Model $parent): void
Create a new relation instance.
Create a new relation instance.
Overriden by
|
#
|
public
static
|
noConstraints(Closure $callback): mixed
Run a callback with constraints disabled on the relation.
Run a callback with constraints disabled on the relation.
|
#
|
abstract
public
|
addConstraints(): void
Set the base constraints on the relation query.
Set the base constraints on the relation query.
Implemented by
|
#
|
abstract
public
|
addEagerConstraints(array $models): void
Set the constraints for an eager load of the relation.
Set the constraints for an eager load of the relation.
Implemented by
|
#
|
abstract
public
|
initRelation(array $models, string $relation): array
Initialize the relation on a set of models.
Initialize the relation on a set of models.
Implemented by
|
#
|
abstract
public
|
match(array $models, Collection $results, string $relation): array
Match the eagerly loaded results to their parents.
Match the eagerly loaded results to their parents.
Implemented by
|
#
|
abstract
public
|
getResults(): mixed
Get the results of the relationship.
Get the results of the relationship.
Implemented by
|
#
|
public
|
getEager(): Collection
Get the relationship for eager loading.
Get the relationship for eager loading.
Overriden by
|
#
|
public
|
sole(array|string $columns = ['*']): Model
Execute the query and get the first result if it's the sole matching record.
Execute the query and get the first result if it's the sole matching record.
Throws
|
#
|
public
|
get(array $columns = ['*']): Collection
Execute the query as a "select" statement.
Execute the query as a "select" statement.
Overriden by
|
#
|
public
|
touch(): void
Touch all of the related models for the relationship.
Touch all of the related models for the relationship.
Overriden by
|
#
|
public
|
rawUpdate(array $attributes = []): int
Run a raw update against the base query.
Run a raw update against the base query.
|
#
|
public
|
getRelationExistenceCountQuery(Builder $query, Builder $parentQuery): Builder
Add the constraints for a relationship count query.
Add the constraints for a relationship count query.
|
#
|
public
|
getRelationExistenceQuery(Builder $query, Builder $parentQuery, array|mixed $columns = ['*']): Builder
Add the constraints for an internal relationship existence query.
Add the constraints for an internal relationship existence query.
Essentially, these queries compare on column names like whereColumn.
Overriden by
|
#
|
public
|
getRelationCountHash(bool $incrementJoinCount = true): string
Get a relationship join table hash.
Get a relationship join table hash.
|
#
|
public
|
getQuery(): Builder
Get the underlying query for the relation.
Get the underlying query for the relation.
|
#
|
public
|
getBaseQuery(): Builder
Get the base query builder driving the Eloquent builder.
Get the base query builder driving the Eloquent builder.
|
#
|
public
|
getParent(): Model
Get the parent model of the relation.
Get the parent model of the relation.
|
#
|
public
|
getQualifiedParentKeyName(): string
Get the fully qualified parent key name.
Get the fully qualified parent key name.
Overriden by
|
#
|
public
|
getRelated(): Model
Get the related model of the relation.
Get the related model of the relation.
|
#
|
public
|
createdAt(): string
Get the name of the "created at" column.
Get the name of the "created at" column.
Overriden by
|
#
|
public
|
updatedAt(): string
Get the name of the "updated at" column.
Get the name of the "updated at" column.
Overriden by
|
#
|
public
|
relatedUpdatedAt(): string
Get the name of the related model's "updated at" column.
Get the name of the related model's "updated at" column.
|
#
|
public
static
|
requireMorphMap(bool $requireMorphMap = true): void
Prevent polymorphic relationships from being used without model mappings.
Prevent polymorphic relationships from being used without model mappings.
|
#
|
public
static
|
requiresMorphMap(): bool
Determine if polymorphic relationships require explicit model mapping.
Determine if polymorphic relationships require explicit model mapping.
|
#
|
public
static
|
enforceMorphMap(array $map, bool $merge = true): array
Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped.
Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped.
|
#
|
public
static
|
morphMap(array|null $map = null, bool $merge = true): array
Set or get the morph map for polymorphic relations.
Set or get the morph map for polymorphic relations.
|
#
|
public
static
|
getMorphedModel(string $alias): string|null
Get the model associated with a custom polymorphic type.
Get the model associated with a custom polymorphic type.
|
#
|
public
|
__call(string $method, array $parameters): mixed
Handle dynamic method calls to the relationship.
Handle dynamic method calls to the relationship.
Overriden by
|
#
|
public
|
__clone(): void
Force a clone of the underlying query builder when cloning.
Force a clone of the underlying query builder when cloning.
|
#
|