HasManyThrough
class HasManyThrough extends Relation (View source)
Methods
Create a new has many through relationship instance.
Set the base constraints on the relation query.
Set the constraints for an eager load of the relation.
Initialize the relation on a set of models.
Match the eagerly loaded results to their parents.
Get the results of the relationship.
Add the constraints for a relationship count query.
Add the constraints for a relationship query.
Set or get the morph map for polymorphic relations.
Handle dynamic method calls to the relationship.
Determine whether close parent of the relation uses Soft Deletes.
Execute the query and get the first related model.
Execute the query and get the first result or throw an exception.
Find a related model by its primary key.
Find multiple related models by their primary keys.
Find a related model by its primary key or throw an exception.
Execute the query as a "select" statement.
Get a paginator for the "select" statement.
Paginate the given query into a simple paginator.
Get the key for comparing against the parent key in "has" query.
Get the qualified foreign key on the related model.
Get the qualified foreign key on the "through" model.
Details
at line line 53
void
__construct(
Builder $query,
Model $farParent,
Model $parent,
string $firstKey,
string $secondKey,
string $localKey)
Create a new has many through relationship instance.
at line line 137
void
addEagerConstraints(
array $models)
Set the constraints for an eager load of the relation.
at line line 151
array
initRelation(
array $models,
string $relation)
Initialize the relation on a set of models.
at line line 168
array
match(
array $models,
Collection $results,
string $relation)
Match the eagerly loaded results to their parents.
Builder
getRelationCountQuery(
Builder $query,
Builder $parent)
Add the constraints for a relationship count query.
at line line 89
Builder
getRelationQuery(
Builder $query,
Builder $parent,
array|mixed $columns = array('*'))
Add the constraints for a relationship query.
static
mixed
noConstraints(
Closure $callback)
Run a callback with constraints disabled on the relation.
static
array
morphMap(
array $map = null,
bool $merge = true)
Set or get the morph map for polymorphic relations.
at line line 126
bool
parentSoftDeletes()
Determine whether close parent of the relation uses Soft Deletes.
at line line 226
mixed
first(
array $columns = array('*'))
Execute the query and get the first related model.
at line line 241
Model|HasManyThrough
firstOrFail(
array $columns = array('*'))
Execute the query and get the first result or throw an exception.
at line line 257
Model|Collection|null
find(
mixed $id,
array $columns = array('*'))
Find a related model by its primary key.
at line line 275
Collection
findMany(
mixed $ids,
array $columns = array('*'))
Find multiple related models by their primary keys.
at line line 295
Model|Collection
findOrFail(
mixed $id,
array $columns = array('*'))
Find a related model by its primary key or throw an exception.
at line line 316
Collection
get(
array $columns = array('*'))
Execute the query as a "select" statement.
at line line 363
LengthAwarePaginator
paginate(
int $perPage = null,
array $columns = array('*'),
string $pageName = 'page',
int $page = null)
Get a paginator for the "select" statement.
at line line 378
Paginator
simplePaginate(
int $perPage = null,
array $columns = array('*'),
string $pageName = 'page')
Paginate the given query into a simple paginator.
at line line 390
string
getHasCompareKey()
Get the key for comparing against the parent key in "has" query.