api/laravel/Database/Eloquent/Concerns/QueriesRelationships.yaml
2024-09-26 02:03:21 -07:00

893 lines
20 KiB
YAML

name: QueriesRelationships
class_comment: null
dependencies:
- name: BadMethodCallException
type: class
source: BadMethodCallException
- name: Closure
type: class
source: Closure
- name: Builder
type: class
source: Illuminate\Database\Eloquent\Builder
- name: Collection
type: class
source: Illuminate\Database\Eloquent\Collection
- name: RelationNotFoundException
type: class
source: Illuminate\Database\Eloquent\RelationNotFoundException
- name: BelongsTo
type: class
source: Illuminate\Database\Eloquent\Relations\BelongsTo
- name: MorphTo
type: class
source: Illuminate\Database\Eloquent\Relations\MorphTo
- name: Relation
type: class
source: Illuminate\Database\Eloquent\Relations\Relation
- name: QueryBuilder
type: class
source: Illuminate\Database\Query\Builder
- name: Expression
type: class
source: Illuminate\Database\Query\Expression
- name: Str
type: class
source: Illuminate\Support\Str
- name: InvalidArgumentException
type: class
source: InvalidArgumentException
properties: []
methods:
- name: has
visibility: public
parameters:
- name: relation
- name: operator
default: '''>'
- name: count
default: '1'
- name: boolean
default: '''and'''
- name: callback
default: 'null'
comment: '# @mixin \Illuminate\Database\Eloquent\Builder */
# trait QueriesRelationships
# {
# /**
# * Add a relationship count / exists condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param string $operator
# * @param int $count
# * @param string $boolean
# * @param \Closure|null $callback
# * @return $this
# *
# * @throws \RuntimeException'
- name: hasNested
visibility: protected
parameters:
- name: relations
- name: operator
default: '''>'
- name: count
default: '1'
- name: boolean
default: '''and'''
- name: callback
default: 'null'
comment: '# * Add nested relationship count / exists conditions to the query.
# *
# * Sets up recursive call to whereHas until we finish the nested relation.
# *
# * @param string $relations
# * @param string $operator
# * @param int $count
# * @param string $boolean
# * @param \Closure|null $callback
# * @return $this'
- name: orHas
visibility: public
parameters:
- name: relation
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a relationship count / exists condition to the query with an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param string $operator
# * @param int $count
# * @return $this'
- name: doesntHave
visibility: public
parameters:
- name: relation
- name: boolean
default: '''and'''
- name: callback
default: 'null'
comment: '# * Add a relationship count / exists condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param string $boolean
# * @param \Closure|null $callback
# * @return $this'
- name: orDoesntHave
visibility: public
parameters:
- name: relation
comment: '# * Add a relationship count / exists condition to the query with an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @return $this'
- name: whereHas
visibility: public
parameters:
- name: relation
- name: callback
default: 'null'
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a relationship count / exists condition to the query with where
clauses.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|null $callback
# * @param string $operator
# * @param int $count
# * @return $this'
- name: withWhereHas
visibility: public
parameters:
- name: relation
- name: callback
default: 'null'
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a relationship count / exists condition to the query with where
clauses.
# *
# * Also load the relationship with same condition.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|null $callback
# * @param string $operator
# * @param int $count
# * @return $this'
- name: orWhereHas
visibility: public
parameters:
- name: relation
- name: callback
default: 'null'
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a relationship count / exists condition to the query with where
clauses and an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|null $callback
# * @param string $operator
# * @param int $count
# * @return $this'
- name: whereDoesntHave
visibility: public
parameters:
- name: relation
- name: callback
default: 'null'
comment: '# * Add a relationship count / exists condition to the query with where
clauses.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|null $callback
# * @return $this'
- name: orWhereDoesntHave
visibility: public
parameters:
- name: relation
- name: callback
default: 'null'
comment: '# * Add a relationship count / exists condition to the query with where
clauses and an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|null $callback
# * @return $this'
- name: hasMorph
visibility: public
parameters:
- name: relation
- name: types
- name: operator
default: '''>'
- name: count
default: '1'
- name: boolean
default: '''and'''
- name: callback
default: 'null'
comment: '# * Add a polymorphic relationship count / exists condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param string $operator
# * @param int $count
# * @param string $boolean
# * @param \Closure|null $callback
# * @return $this'
- name: getBelongsToRelation
visibility: protected
parameters:
- name: relation
- name: type
comment: '# * Get the BelongsTo relationship for a single polymorphic type.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, TDeclaringModel> $relation
# * @param class-string<TRelatedModel> $type
# * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<TRelatedModel, TDeclaringModel>'
- name: orHasMorph
visibility: public
parameters:
- name: relation
- name: types
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a polymorphic relationship count / exists condition to the query
with an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param string $operator
# * @param int $count
# * @return $this'
- name: doesntHaveMorph
visibility: public
parameters:
- name: relation
- name: types
- name: boolean
default: '''and'''
- name: callback
default: 'null'
comment: '# * Add a polymorphic relationship count / exists condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param string $boolean
# * @param \Closure|null $callback
# * @return $this'
- name: orDoesntHaveMorph
visibility: public
parameters:
- name: relation
- name: types
comment: '# * Add a polymorphic relationship count / exists condition to the query
with an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @return $this'
- name: whereHasMorph
visibility: public
parameters:
- name: relation
- name: types
- name: callback
default: 'null'
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a polymorphic relationship count / exists condition to the query
with where clauses.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|null $callback
# * @param string $operator
# * @param int $count
# * @return $this'
- name: orWhereHasMorph
visibility: public
parameters:
- name: relation
- name: types
- name: callback
default: 'null'
- name: operator
default: '''>'
- name: count
default: '1'
comment: '# * Add a polymorphic relationship count / exists condition to the query
with where clauses and an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|null $callback
# * @param string $operator
# * @param int $count
# * @return $this'
- name: whereDoesntHaveMorph
visibility: public
parameters:
- name: relation
- name: types
- name: callback
default: 'null'
comment: '# * Add a polymorphic relationship count / exists condition to the query
with where clauses.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|null $callback
# * @return $this'
- name: orWhereDoesntHaveMorph
visibility: public
parameters:
- name: relation
- name: types
- name: callback
default: 'null'
comment: '# * Add a polymorphic relationship count / exists condition to the query
with where clauses and an "or".
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|null $callback
# * @return $this'
- name: whereRelation
visibility: public
parameters:
- name: relation
- name: column
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Add a basic where clause to a relationship query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression $column
# * @param mixed $operator
# * @param mixed $value
# * @return $this'
- name: orWhereRelation
visibility: public
parameters:
- name: relation
- name: column
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Add an "or where" clause to a relationship query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>|string $relation
# * @param \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression $column
# * @param mixed $operator
# * @param mixed $value
# * @return $this'
- name: whereMorphRelation
visibility: public
parameters:
- name: relation
- name: types
- name: column
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Add a polymorphic relationship condition to the query with a where
clause.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression $column
# * @param mixed $operator
# * @param mixed $value
# * @return $this'
- name: orWhereMorphRelation
visibility: public
parameters:
- name: relation
- name: types
- name: column
- name: operator
default: 'null'
- name: value
default: 'null'
comment: '# * Add a polymorphic relationship condition to the query with an "or
where" clause.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param string|array $types
# * @param \Closure|string|array|\Illuminate\Contracts\Database\Query\Expression $column
# * @param mixed $operator
# * @param mixed $value
# * @return $this'
- name: whereMorphedTo
visibility: public
parameters:
- name: relation
- name: model
- name: boolean
default: '''and'''
comment: '# * Add a morph-to relationship condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param \Illuminate\Database\Eloquent\Model|string|null $model
# * @return $this'
- name: whereNotMorphedTo
visibility: public
parameters:
- name: relation
- name: model
- name: boolean
default: '''and'''
comment: '# * Add a not morph-to relationship condition to the query.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param \Illuminate\Database\Eloquent\Model|string $model
# * @return $this'
- name: orWhereMorphedTo
visibility: public
parameters:
- name: relation
- name: model
comment: '# * Add a morph-to relationship condition to the query with an "or where"
clause.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param \Illuminate\Database\Eloquent\Model|string|null $model
# * @return $this'
- name: orWhereNotMorphedTo
visibility: public
parameters:
- name: relation
- name: model
comment: '# * Add a not morph-to relationship condition to the query with an "or
where" clause.
# *
# * @param \Illuminate\Database\Eloquent\Relations\MorphTo<*, *>|string $relation
# * @param \Illuminate\Database\Eloquent\Model|string $model
# * @return $this'
- name: whereBelongsTo
visibility: public
parameters:
- name: related
- name: relationshipName
default: 'null'
- name: boolean
default: '''and'''
comment: '# * Add a "belongs to" relationship where clause to the query.
# *
# * @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection<int,
\Illuminate\Database\Eloquent\Model> $related
# * @param string|null $relationshipName
# * @param string $boolean
# * @return $this
# *
# * @throws \Illuminate\Database\Eloquent\RelationNotFoundException'
- name: orWhereBelongsTo
visibility: public
parameters:
- name: related
- name: relationshipName
default: 'null'
comment: '# * Add an "BelongsTo" relationship with an "or where" clause to the query.
# *
# * @param \Illuminate\Database\Eloquent\Model $related
# * @param string|null $relationshipName
# * @return $this
# *
# * @throws \RuntimeException'
- name: withAggregate
visibility: public
parameters:
- name: relations
- name: column
- name: function
default: 'null'
comment: '# * Add subselect queries to include an aggregate value for a relationship.
# *
# * @param mixed $relations
# * @param \Illuminate\Contracts\Database\Query\Expression|string $column
# * @param string $function
# * @return $this'
- name: getRelationHashedColumn
visibility: protected
parameters:
- name: column
- name: relation
comment: '# * Get the relation hashed column name for the given column and relation.
# *
# * @param string $column
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $relation
# * @return string'
- name: withCount
visibility: public
parameters:
- name: relations
comment: '# * Add subselect queries to count the relations.
# *
# * @param mixed $relations
# * @return $this'
- name: withMax
visibility: public
parameters:
- name: relation
- name: column
comment: '# * Add subselect queries to include the max of the relation''s column.
# *
# * @param string|array $relation
# * @param \Illuminate\Contracts\Database\Query\Expression|string $column
# * @return $this'
- name: withMin
visibility: public
parameters:
- name: relation
- name: column
comment: '# * Add subselect queries to include the min of the relation''s column.
# *
# * @param string|array $relation
# * @param \Illuminate\Contracts\Database\Query\Expression|string $column
# * @return $this'
- name: withSum
visibility: public
parameters:
- name: relation
- name: column
comment: '# * Add subselect queries to include the sum of the relation''s column.
# *
# * @param string|array $relation
# * @param \Illuminate\Contracts\Database\Query\Expression|string $column
# * @return $this'
- name: withAvg
visibility: public
parameters:
- name: relation
- name: column
comment: '# * Add subselect queries to include the average of the relation''s column.
# *
# * @param string|array $relation
# * @param \Illuminate\Contracts\Database\Query\Expression|string $column
# * @return $this'
- name: withExists
visibility: public
parameters:
- name: relation
comment: '# * Add subselect queries to include the existence of related models.
# *
# * @param string|array $relation
# * @return $this'
- name: addHasWhere
visibility: protected
parameters:
- name: hasQuery
- name: relation
- name: operator
- name: count
- name: boolean
comment: '# * Add the "has" condition where clause to the query.
# *
# * @param \Illuminate\Database\Eloquent\Builder<*> $hasQuery
# * @param \Illuminate\Database\Eloquent\Relations\Relation<*, *, *> $relation
# * @param string $operator
# * @param int $count
# * @param string $boolean
# * @return $this'
- name: mergeConstraintsFrom
visibility: public
parameters:
- name: from
comment: '# * Merge the where constraints from another query to the current query.
# *
# * @param \Illuminate\Database\Eloquent\Builder<*> $from
# * @return $this'
- name: requalifyWhereTables
visibility: protected
parameters:
- name: wheres
- name: from
- name: to
comment: '# * Updates the table name for any columns with a new qualified name.
# *
# * @param array $wheres
# * @param string $from
# * @param string $to
# * @return array'
- name: addWhereCountQuery
visibility: protected
parameters:
- name: query
- name: operator
default: '''>'
- name: count
default: '1'
- name: boolean
default: '''and'''
comment: '# * Add a sub-query count clause to this query.
# *
# * @param \Illuminate\Database\Query\Builder $query
# * @param string $operator
# * @param int $count
# * @param string $boolean
# * @return $this'
- name: getRelationWithoutConstraints
visibility: protected
parameters:
- name: relation
comment: '# * Get the "has relation" base query instance.
# *
# * @param string $relation
# * @return \Illuminate\Database\Eloquent\Relations\Relation<*, *, *>'
- name: canUseExistsForExistenceCheck
visibility: protected
parameters:
- name: operator
- name: count
comment: '# * Check if we can run an "exists" query to optimize performance.
# *
# * @param string $operator
# * @param int $count
# * @return bool'
traits:
- BadMethodCallException
- Closure
- Illuminate\Database\Eloquent\Builder
- Illuminate\Database\Eloquent\Collection
- Illuminate\Database\Eloquent\RelationNotFoundException
- Illuminate\Database\Eloquent\Relations\BelongsTo
- Illuminate\Database\Eloquent\Relations\MorphTo
- Illuminate\Database\Eloquent\Relations\Relation
- Illuminate\Database\Query\Expression
- Illuminate\Support\Str
- InvalidArgumentException
interfaces: []