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

1129 lines
26 KiB
YAML

name: HasRelationships
class_comment: null
dependencies:
- name: Closure
type: class
source: Closure
- name: ClassMorphViolationException
type: class
source: Illuminate\Database\ClassMorphViolationException
- name: Builder
type: class
source: Illuminate\Database\Eloquent\Builder
- name: Collection
type: class
source: Illuminate\Database\Eloquent\Collection
- name: Model
type: class
source: Illuminate\Database\Eloquent\Model
- name: PendingHasThroughRelationship
type: class
source: Illuminate\Database\Eloquent\PendingHasThroughRelationship
- name: BelongsTo
type: class
source: Illuminate\Database\Eloquent\Relations\BelongsTo
- name: BelongsToMany
type: class
source: Illuminate\Database\Eloquent\Relations\BelongsToMany
- name: HasMany
type: class
source: Illuminate\Database\Eloquent\Relations\HasMany
- name: HasManyThrough
type: class
source: Illuminate\Database\Eloquent\Relations\HasManyThrough
- name: HasOne
type: class
source: Illuminate\Database\Eloquent\Relations\HasOne
- name: HasOneThrough
type: class
source: Illuminate\Database\Eloquent\Relations\HasOneThrough
- name: MorphMany
type: class
source: Illuminate\Database\Eloquent\Relations\MorphMany
- name: MorphOne
type: class
source: Illuminate\Database\Eloquent\Relations\MorphOne
- name: MorphTo
type: class
source: Illuminate\Database\Eloquent\Relations\MorphTo
- name: MorphToMany
type: class
source: Illuminate\Database\Eloquent\Relations\MorphToMany
- name: Pivot
type: class
source: Illuminate\Database\Eloquent\Relations\Pivot
- name: Relation
type: class
source: Illuminate\Database\Eloquent\Relations\Relation
- name: Arr
type: class
source: Illuminate\Support\Arr
- name: Str
type: class
source: Illuminate\Support\Str
properties:
- name: relations
visibility: protected
comment: '# * The loaded relationships for the model.
# *
# * @var array'
- name: touches
visibility: protected
comment: '# * The relationships that should be touched on save.
# *
# * @var array'
- name: manyMethods
visibility: public
comment: '# * The many to many relationship methods.
# *
# * @var string[]'
- name: relationResolvers
visibility: protected
comment: '# * The relation resolver callbacks.
# *
# * @var array'
methods:
- name: relationResolver
visibility: public
parameters:
- name: class
- name: key
comment: "# * The loaded relationships for the model.\n# *\n# * @var array\n# */\n\
# protected $relations = [];\n# \n# /**\n# * The relationships that should be\
\ touched on save.\n# *\n# * @var array\n# */\n# protected $touches = [];\n# \n\
# /**\n# * The many to many relationship methods.\n# *\n# * @var string[]\n# */\n\
# public static $manyMethods = [\n# 'belongsToMany', 'morphToMany', 'morphedByMany',\n\
# ];\n# \n# /**\n# * The relation resolver callbacks.\n# *\n# * @var array\n#\
\ */\n# protected static $relationResolvers = [];\n# \n# /**\n# * Get the dynamic\
\ relation resolver if defined or inherited, or return null.\n# *\n# * @param\
\ string $class\n# * @param string $key\n# * @return mixed"
- name: resolveRelationUsing
visibility: public
parameters:
- name: name
- name: callback
comment: '# * Define a dynamic relation resolver.
# *
# * @param string $name
# * @param \Closure $callback
# * @return void'
- name: hasOne
visibility: public
parameters:
- name: related
- name: foreignKey
default: 'null'
- name: localKey
default: 'null'
comment: '# * Define a one-to-one relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string|null $foreignKey
# * @param string|null $localKey
# * @return \Illuminate\Database\Eloquent\Relations\HasOne<TRelatedModel, $this>'
- name: newHasOne
visibility: protected
parameters:
- name: query
- name: parent
- name: foreignKey
- name: localKey
comment: '# * Instantiate a new HasOne relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $foreignKey
# * @param string $localKey
# * @return \Illuminate\Database\Eloquent\Relations\HasOne<TRelatedModel, TDeclaringModel>'
- name: hasOneThrough
visibility: public
parameters:
- name: related
- name: through
- name: firstKey
default: 'null'
- name: secondKey
default: 'null'
- name: localKey
default: 'null'
- name: secondLocalKey
default: 'null'
comment: '# * Define a has-one-through relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param class-string<TIntermediateModel> $through
# * @param string|null $firstKey
# * @param string|null $secondKey
# * @param string|null $localKey
# * @param string|null $secondLocalKey
# * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough<TRelatedModel,
TIntermediateModel, $this>'
- name: newHasOneThrough
visibility: protected
parameters:
- name: query
- name: farParent
- name: throughParent
- name: firstKey
- name: secondKey
- name: localKey
- name: secondLocalKey
comment: '# * Instantiate a new HasOneThrough relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $farParent
# * @param TIntermediateModel $throughParent
# * @param string $firstKey
# * @param string $secondKey
# * @param string $localKey
# * @param string $secondLocalKey
# * @return \Illuminate\Database\Eloquent\Relations\HasOneThrough<TRelatedModel,
TIntermediateModel, TDeclaringModel>'
- name: morphOne
visibility: public
parameters:
- name: related
- name: name
- name: type
default: 'null'
- name: id
default: 'null'
- name: localKey
default: 'null'
comment: '# * Define a polymorphic one-to-one relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string $name
# * @param string|null $type
# * @param string|null $id
# * @param string|null $localKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphOne<TRelatedModel, $this>'
- name: newMorphOne
visibility: protected
parameters:
- name: query
- name: parent
- name: type
- name: id
- name: localKey
comment: '# * Instantiate a new MorphOne relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $type
# * @param string $id
# * @param string $localKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphOne<TRelatedModel, TDeclaringModel>'
- name: belongsTo
visibility: public
parameters:
- name: related
- name: foreignKey
default: 'null'
- name: ownerKey
default: 'null'
- name: relation
default: 'null'
comment: '# * Define an inverse one-to-one or many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string|null $foreignKey
# * @param string|null $ownerKey
# * @param string|null $relation
# * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<TRelatedModel, $this>'
- name: newBelongsTo
visibility: protected
parameters:
- name: query
- name: child
- name: foreignKey
- name: ownerKey
- name: relation
comment: '# * Instantiate a new BelongsTo relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $child
# * @param string $foreignKey
# * @param string $ownerKey
# * @param string $relation
# * @return \Illuminate\Database\Eloquent\Relations\BelongsTo<TRelatedModel, TDeclaringModel>'
- name: morphTo
visibility: public
parameters:
- name: name
default: 'null'
- name: type
default: 'null'
- name: id
default: 'null'
- name: ownerKey
default: 'null'
comment: '# * Define a polymorphic, inverse one-to-one or many relationship.
# *
# * @param string|null $name
# * @param string|null $type
# * @param string|null $id
# * @param string|null $ownerKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model,
$this>'
- name: morphEagerTo
visibility: protected
parameters:
- name: name
- name: type
- name: id
- name: ownerKey
comment: '# * Define a polymorphic, inverse one-to-one or many relationship.
# *
# * @param string $name
# * @param string $type
# * @param string $id
# * @param string $ownerKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model,
$this>'
- name: morphInstanceTo
visibility: protected
parameters:
- name: target
- name: name
- name: type
- name: id
- name: ownerKey
comment: '# * Define a polymorphic, inverse one-to-one or many relationship.
# *
# * @param string $target
# * @param string $name
# * @param string $type
# * @param string $id
# * @param string $ownerKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model,
$this>'
- name: newMorphTo
visibility: protected
parameters:
- name: query
- name: parent
- name: foreignKey
- name: ownerKey
- name: type
- name: relation
comment: '# * Instantiate a new MorphTo relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $foreignKey
# * @param string $ownerKey
# * @param string $type
# * @param string $relation
# * @return \Illuminate\Database\Eloquent\Relations\MorphTo<TRelatedModel, TDeclaringModel>'
- name: getActualClassNameForMorph
visibility: public
parameters:
- name: class
comment: '# * Retrieve the actual class name for a given morph class.
# *
# * @param string $class
# * @return string'
- name: guessBelongsToRelation
visibility: protected
parameters: []
comment: '# * Guess the "belongs to" relationship name.
# *
# * @return string'
- name: through
visibility: public
parameters:
- name: relationship
comment: '# * Create a pending has-many-through or has-one-through relationship.
# *
# * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model
# *
# * @param string|\Illuminate\Database\Eloquent\Relations\HasMany<TIntermediateModel,
covariant $this>|\Illuminate\Database\Eloquent\Relations\HasOne<TIntermediateModel,
covariant $this> $relationship
# * @return (
# * $relationship is string
# * ? \Illuminate\Database\Eloquent\PendingHasThroughRelationship<\Illuminate\Database\Eloquent\Model,
$this>
# * : \Illuminate\Database\Eloquent\PendingHasThroughRelationship<TIntermediateModel,
$this>
# * )'
- name: hasMany
visibility: public
parameters:
- name: related
- name: foreignKey
default: 'null'
- name: localKey
default: 'null'
comment: '# * Define a one-to-many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string|null $foreignKey
# * @param string|null $localKey
# * @return \Illuminate\Database\Eloquent\Relations\HasMany<TRelatedModel, $this>'
- name: newHasMany
visibility: protected
parameters:
- name: query
- name: parent
- name: foreignKey
- name: localKey
comment: '# * Instantiate a new HasMany relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $foreignKey
# * @param string $localKey
# * @return \Illuminate\Database\Eloquent\Relations\HasMany<TRelatedModel, TDeclaringModel>'
- name: hasManyThrough
visibility: public
parameters:
- name: related
- name: through
- name: firstKey
default: 'null'
- name: secondKey
default: 'null'
- name: localKey
default: 'null'
- name: secondLocalKey
default: 'null'
comment: '# * Define a has-many-through relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param class-string<TIntermediateModel> $through
# * @param string|null $firstKey
# * @param string|null $secondKey
# * @param string|null $localKey
# * @param string|null $secondLocalKey
# * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<TRelatedModel,
TIntermediateModel, $this>'
- name: newHasManyThrough
visibility: protected
parameters:
- name: query
- name: farParent
- name: throughParent
- name: firstKey
- name: secondKey
- name: localKey
- name: secondLocalKey
comment: '# * Instantiate a new HasManyThrough relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TIntermediateModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $farParent
# * @param TIntermediateModel $throughParent
# * @param string $firstKey
# * @param string $secondKey
# * @param string $localKey
# * @param string $secondLocalKey
# * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough<TRelatedModel,
TIntermediateModel, TDeclaringModel>'
- name: morphMany
visibility: public
parameters:
- name: related
- name: name
- name: type
default: 'null'
- name: id
default: 'null'
- name: localKey
default: 'null'
comment: '# * Define a polymorphic one-to-many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string $name
# * @param string|null $type
# * @param string|null $id
# * @param string|null $localKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphMany<TRelatedModel, $this>'
- name: newMorphMany
visibility: protected
parameters:
- name: query
- name: parent
- name: type
- name: id
- name: localKey
comment: '# * Instantiate a new MorphMany relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $type
# * @param string $id
# * @param string $localKey
# * @return \Illuminate\Database\Eloquent\Relations\MorphMany<TRelatedModel, TDeclaringModel>'
- name: belongsToMany
visibility: public
parameters:
- name: related
- name: table
default: 'null'
- name: foreignPivotKey
default: 'null'
- name: relatedPivotKey
default: 'null'
- name: parentKey
default: 'null'
- name: relatedKey
default: 'null'
- name: relation
default: 'null'
comment: '# * Define a many-to-many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string|class-string<\Illuminate\Database\Eloquent\Model>|null $table
# * @param string|null $foreignPivotKey
# * @param string|null $relatedPivotKey
# * @param string|null $parentKey
# * @param string|null $relatedKey
# * @param string|null $relation
# * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<TRelatedModel,
$this>'
- name: newBelongsToMany
visibility: protected
parameters:
- name: query
- name: parent
- name: table
- name: foreignPivotKey
- name: relatedPivotKey
- name: parentKey
- name: relatedKey
- name: relationName
default: 'null'
comment: '# * Instantiate a new BelongsToMany relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string|class-string<\Illuminate\Database\Eloquent\Model> $table
# * @param string $foreignPivotKey
# * @param string $relatedPivotKey
# * @param string $parentKey
# * @param string $relatedKey
# * @param string|null $relationName
# * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany<TRelatedModel,
TDeclaringModel>'
- name: morphToMany
visibility: public
parameters:
- name: related
- name: name
- name: table
default: 'null'
- name: foreignPivotKey
default: 'null'
- name: relatedPivotKey
default: 'null'
- name: parentKey
default: 'null'
- name: relatedKey
default: 'null'
- name: relation
default: 'null'
- name: inverse
default: 'false'
comment: '# * Define a polymorphic many-to-many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string $name
# * @param string|null $table
# * @param string|null $foreignPivotKey
# * @param string|null $relatedPivotKey
# * @param string|null $parentKey
# * @param string|null $relatedKey
# * @param string|null $relation
# * @param bool $inverse
# * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<TRelatedModel,
$this>'
- name: newMorphToMany
visibility: protected
parameters:
- name: query
- name: parent
- name: name
- name: table
- name: foreignPivotKey
- name: relatedPivotKey
- name: parentKey
- name: relatedKey
- name: relationName
default: 'null'
- name: inverse
default: 'false'
comment: '# * Instantiate a new MorphToMany relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model
# *
# * @param \Illuminate\Database\Eloquent\Builder<TRelatedModel> $query
# * @param TDeclaringModel $parent
# * @param string $name
# * @param string $table
# * @param string $foreignPivotKey
# * @param string $relatedPivotKey
# * @param string $parentKey
# * @param string $relatedKey
# * @param string|null $relationName
# * @param bool $inverse
# * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<TRelatedModel,
TDeclaringModel>'
- name: morphedByMany
visibility: public
parameters:
- name: related
- name: name
- name: table
default: 'null'
- name: foreignPivotKey
default: 'null'
- name: relatedPivotKey
default: 'null'
- name: parentKey
default: 'null'
- name: relatedKey
default: 'null'
- name: relation
default: 'null'
comment: '# * Define a polymorphic, inverse many-to-many relationship.
# *
# * @template TRelatedModel of \Illuminate\Database\Eloquent\Model
# *
# * @param class-string<TRelatedModel> $related
# * @param string $name
# * @param string|null $table
# * @param string|null $foreignPivotKey
# * @param string|null $relatedPivotKey
# * @param string|null $parentKey
# * @param string|null $relatedKey
# * @param string|null $relation
# * @return \Illuminate\Database\Eloquent\Relations\MorphToMany<TRelatedModel,
$this>'
- name: guessBelongsToManyRelation
visibility: protected
parameters: []
comment: '# * Get the relationship name of the belongsToMany relationship.
# *
# * @return string|null'
- name: joiningTable
visibility: public
parameters:
- name: related
- name: instance
default: 'null'
comment: '# * Get the joining table name for a many-to-many relation.
# *
# * @param string $related
# * @param \Illuminate\Database\Eloquent\Model|null $instance
# * @return string'
- name: joiningTableSegment
visibility: public
parameters: []
comment: '# * Get this model''s half of the intermediate table name for belongsToMany
relationships.
# *
# * @return string'
- name: touches
visibility: public
parameters:
- name: relation
comment: '# * Determine if the model touches a given relation.
# *
# * @param string $relation
# * @return bool'
- name: touchOwners
visibility: public
parameters: []
comment: '# * Touch the owning relations of the model.
# *
# * @return void'
- name: getMorphs
visibility: protected
parameters:
- name: name
- name: type
- name: id
comment: '# * Get the polymorphic relationship columns.
# *
# * @param string $name
# * @param string $type
# * @param string $id
# * @return array'
- name: getMorphClass
visibility: public
parameters: []
comment: '# * Get the class name for polymorphic relations.
# *
# * @return string'
- name: newRelatedInstance
visibility: protected
parameters:
- name: class
comment: '# * Create a new model instance for a related model.
# *
# * @param string $class
# * @return mixed'
- name: newRelatedThroughInstance
visibility: protected
parameters:
- name: class
comment: '# * Create a new model instance for a related "through" model.
# *
# * @param string $class
# * @return mixed'
- name: getRelations
visibility: public
parameters: []
comment: '# * Get all the loaded relations for the instance.
# *
# * @return array'
- name: getRelation
visibility: public
parameters:
- name: relation
comment: '# * Get a specified relationship.
# *
# * @param string $relation
# * @return mixed'
- name: relationLoaded
visibility: public
parameters:
- name: key
comment: '# * Determine if the given relation is loaded.
# *
# * @param string $key
# * @return bool'
- name: setRelation
visibility: public
parameters:
- name: relation
- name: value
comment: '# * Set the given relationship on the model.
# *
# * @param string $relation
# * @param mixed $value
# * @return $this'
- name: unsetRelation
visibility: public
parameters:
- name: relation
comment: '# * Unset a loaded relationship.
# *
# * @param string $relation
# * @return $this'
- name: setRelations
visibility: public
parameters:
- name: relations
comment: '# * Set the entire relations array on the model.
# *
# * @param array $relations
# * @return $this'
- name: withoutRelations
visibility: public
parameters: []
comment: '# * Duplicate the instance and unset all the loaded relations.
# *
# * @return $this'
- name: unsetRelations
visibility: public
parameters: []
comment: '# * Unset all the loaded relations for the instance.
# *
# * @return $this'
- name: getTouchedRelations
visibility: public
parameters: []
comment: '# * Get the relationships that are touched on save.
# *
# * @return array'
- name: setTouchedRelations
visibility: public
parameters:
- name: touches
comment: '# * Set the relationships that are touched on save.
# *
# * @param array $touches
# * @return $this'
traits:
- Closure
- Illuminate\Database\ClassMorphViolationException
- Illuminate\Database\Eloquent\Builder
- Illuminate\Database\Eloquent\Collection
- Illuminate\Database\Eloquent\Model
- Illuminate\Database\Eloquent\PendingHasThroughRelationship
- Illuminate\Database\Eloquent\Relations\BelongsTo
- Illuminate\Database\Eloquent\Relations\BelongsToMany
- Illuminate\Database\Eloquent\Relations\HasMany
- Illuminate\Database\Eloquent\Relations\HasManyThrough
- Illuminate\Database\Eloquent\Relations\HasOne
- Illuminate\Database\Eloquent\Relations\HasOneThrough
- Illuminate\Database\Eloquent\Relations\MorphMany
- Illuminate\Database\Eloquent\Relations\MorphOne
- Illuminate\Database\Eloquent\Relations\MorphTo
- Illuminate\Database\Eloquent\Relations\MorphToMany
- Illuminate\Database\Eloquent\Relations\Pivot
- Illuminate\Database\Eloquent\Relations\Relation
- Illuminate\Support\Arr
- Illuminate\Support\Str
interfaces: []