Methods |
public
|
__construct(
Builder $query,
Model $farParent,
Model $throughParent,
string $firstKey,
string $secondKey,
string $localKey,
string $secondLocalKey,
): void
Create a new has many through relationship instance.
Create a new has many through relationship instance.
Overrides
|
#
|
public
|
addConstraints(): void
Set the base constraints on the relation query.
Set the base constraints on the relation query.
Implements
|
#
|
public
|
getQualifiedParentKeyName(): string
Get the fully qualified parent key name.
Get the fully qualified parent key name.
Overrides
|
#
|
public
|
throughParentSoftDeletes(): bool
Determine whether "through" parent of the relation uses Soft Deletes.
Determine whether "through" parent of the relation uses Soft Deletes.
|
#
|
public
|
withTrashedParents(): $this
Indicate that trashed "through" parents should be included in the query.
Indicate that trashed "through" parents should be included in the query.
|
#
|
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.
Implements
|
#
|
public
|
initRelation(array $models, string $relation): array
Initialize the relation on a set of models.
Initialize the relation on a set of models.
Overriden by
Implements
|
#
|
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.
Overriden by
Implements
|
#
|
public
|
firstOrNew(array $attributes): Model
Get the first related model record matching the attributes or instantiate it.
Get the first related model record matching the attributes or instantiate it.
|
#
|
public
|
updateOrCreate(array $attributes, array $values = []): Model
Create or update a related record matching the attributes, and fill it with values.
Create or update a related record matching the attributes, and fill it with values.
|
#
|
public
|
firstWhere(
Closure|string|array $column,
mixed $operator = null,
mixed $value = null,
string $boolean = 'and',
): Model|static
Add a basic where clause to the query, and return the first result.
Add a basic where clause to the query, and return the first result.
|
#
|
public
|
first(array $columns = ['*']): mixed
Execute the query and get the first related model.
Execute the query and get the first related model.
|
#
|
public
|
firstOrFail(array $columns = ['*']): Model|static
Execute the query and get the first result or throw an exception.
Execute the query and get the first result or throw an exception.
Throws
|
#
|
public
|
find(mixed $id, array $columns = ['*']): Model|Collection|null
Find a related model by its primary key.
Find a related model by its primary key.
|
#
|
public
|
findMany(Arrayable|array $ids, array $columns = ['*']): Collection
Find multiple related models by their primary keys.
Find multiple related models by their primary keys.
|
#
|
public
|
findOrFail(mixed $id, array $columns = ['*']): Model|Collection
Find a related model by its primary key or throw an exception.
Find a related model by its primary key or throw an exception.
Throws
|
#
|
public
|
getResults(): mixed
Get the results of the relationship.
Get the results of the relationship.
Overriden by
Implements
|
#
|
public
|
get(array $columns = ['*']): Collection
Execute the query as a "select" statement.
Execute the query as a "select" statement.
Overrides
|
#
|
public
|
paginate(
int|null $perPage = null,
array $columns = ['*'],
string $pageName = 'page',
int $page = null,
): LengthAwarePaginator
Get a paginator for the "select" statement.
Get a paginator for the "select" statement.
|
#
|
public
|
simplePaginate(
int|null $perPage = null,
array $columns = ['*'],
string $pageName = 'page',
int|null $page = null,
): Paginator
Paginate the given query into a simple paginator.
Paginate the given query into a simple paginator.
|
#
|
public
|
cursorPaginate(
int|null $perPage = null,
array $columns = ['*'],
string $cursorName = 'cursor',
string|null $cursor = null,
): CursorPaginator
Paginate the given query into a cursor paginator.
Paginate the given query into a cursor paginator.
|
#
|
public
|
chunk(int $count, callable $callback): bool
Chunk the results of the query.
Chunk the results of the query.
|
#
|
public
|
chunkById(int $count, callable $callback, string|null $column = null, string|null $alias = null): bool
Chunk the results of a query by comparing numeric IDs.
Chunk the results of a query by comparing numeric IDs.
|
#
|
public
|
cursor(): Generator
Get a generator for the given query.
Get a generator for the given query.
|
#
|
public
|
each(callable $callback, int $count = 1000): bool
Execute a callback over each item while chunking.
Execute a callback over each item while chunking.
|
#
|
public
|
lazy(int $chunkSize = 1000): LazyCollection
Query lazily, by chunks of the given size.
Query lazily, by chunks of the given size.
|
#
|
public
|
lazyById(int $chunkSize = 1000, string|null $column = null, string|null $alias = null): LazyCollection
Query lazily, by chunking the results of a query by comparing IDs.
Query lazily, by chunking the results of a query by comparing IDs.
|
#
|
public
|
getRelationExistenceQuery(Builder $query, Builder $parentQuery, array|mixed $columns = ['*']): Builder
Add the constraints for a relationship query.
Add the constraints for a relationship query.
Overrides
|
#
|
public
|
getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, array|mixed $columns = ['*']): Builder
Add the constraints for a relationship query on the same table.
Add the constraints for a relationship query on the same table.
|
#
|
public
|
getRelationExistenceQueryForThroughSelfRelation(
Builder $query,
Builder $parentQuery,
array|mixed $columns = ['*'],
): Builder
Add the constraints for a relationship query on the same table as the through parent.
Add the constraints for a relationship query on the same table as the through parent.
|
#
|
public
|
getQualifiedFarKeyName(): string
Get the qualified foreign key on the related model.
Get the qualified foreign key on the related model.
|
#
|
public
|
getFirstKeyName(): string
Get the foreign key on the "through" model.
Get the foreign key on the "through" model.
|
#
|
public
|
getQualifiedFirstKeyName(): string
Get the qualified foreign key on the "through" model.
Get the qualified foreign key on the "through" model.
|
#
|
public
|
getForeignKeyName(): string
Get the foreign key on the related model.
Get the foreign key on the related model.
|
#
|
public
|
getQualifiedForeignKeyName(): string
Get the qualified foreign key on the related model.
Get the qualified foreign key on the related model.
|
#
|
public
|
getLocalKeyName(): string
Get the local key on the far parent model.
Get the local key on the far parent model.
|
#
|
public
|
getQualifiedLocalKeyName(): string
Get the qualified local key on the far parent model.
Get the qualified local key on the far parent model.
|
#
|
public
|
getSecondLocalKeyName(): string
Get the local key on the intermediary model.
Get the local key on the intermediary model.
|
#
|