October\Rain\Database\Relations\MorphMany
Extends
- Illuminate\Database\Eloquent\Relations\MorphMany
- Illuminate\Database\Eloquent\Relations\MorphOneOrMany
- Illuminate\Database\Eloquent\Relations\HasOneOrMany
- Illuminate\Database\Eloquent\Relations\Relation
Implements
- Illuminate\Contracts\Database\Eloquent\Builder
- Illuminate\Contracts\Database\Query\Builder
Public Properties
There are no public properties in the class.
Show inherited public properties
Inherited Public Properties
- $morphMap - An array to map morph names to their class names in the database. (defined in Illuminate\Database\Eloquent\Relations\Relation)
Protected Properties
protected string $relationName
relationName is the "name" of the relationship.
protected bool $pivotSiteScope
pivotSiteScope indicates if pivot queries should be scoped by site_id. This is used for dual-multisite scenarios where both parent and related models use multisite.
Show inherited protected properties
Inherited Protected Properties
- $morphType - The foreign key type for the relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- $morphClass - The morph class of the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- $foreignKey - The foreign key of the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- $localKey - The local key of the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- $query - The Eloquent query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $parent - The parent model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $related - The related model instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $eagerKeysWereEmpty - Indicates whether the eagerly loaded relation should implicitly return an empty collection. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $constraints - Indicates if the relation is adding constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $constraintsForNestedRelations - Indicates whether constraints should be enabled for nested relation attributes. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $requireMorphMap - Prevents morph relationships without a morph map. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $selfJoinCount - The count of self joins. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $macros - The registered string macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- $inverseRelationship - The name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
Public Methods
public __construct()
public __construct(
$query,
$parent,
$type,
$id,
$localKey,
$relationName = null
): void
__construct a new has many relationship instance.
public add()
public add($model, $sessionKey = null): void
add a model to this relationship type.
public addDefinedConstraints()
public addDefinedConstraints(): void
addDefinedConstraints to the relation query
public addDefinedConstraintsToQuery()
public addDefinedConstraintsToQuery($query, $args = null): void
public addDefinedConstraintsToRelation()
public addDefinedConstraintsToRelation($relation, $args = null): void
public create()
public create($attributes = [], $sessionKey = null): void
create a new instance of this related model with deferred binding support.
public createMany()
public createMany($records, $sessionKey = null): void
createMany creates multiple related models with deferred binding support.
public createManyQuietly()
public createManyQuietly($records, $sessionKey = null): void
createManyQuietly creates multiple models without raising any events, with deferred binding support.
public createOrFirst()
public createOrFirst($attributes = [], $values = [], $sessionKey = null): void
createOrFirst attempts to create the record, or if a unique constraint violation occurs, finds the existing record.
public createQuietly()
public createQuietly($attributes = [], $sessionKey = null): void
createQuietly creates a new instance without raising any events, with deferred binding support.
public forceCreateQuietly()
public forceCreateQuietly($attributes = [], $sessionKey = null): void
forceCreateQuietly creates a new instance bypassing mass assignment without raising any events, with deferred binding support.
public getRelatedKeyName()
public getRelatedKeyName(): string
public getSimpleValue()
public getSimpleValue(): void
getSimpleValue helper for getting this relationship simple value, generally useful with form values.
public isPivotSiteScoped()
public isPivotSiteScoped(): bool
isPivotSiteScoped returns true if pivot queries should be scoped by site_id.
public remove()
public remove($model, $sessionKey = null): void
remove a model from this relationship type.
public save()
public save($model, $sessionKey = null): void
save the supplied related model with deferred binding support.
public saveMany()
public saveMany($models, $sessionKey = null): void
saveMany saves multiple models with deferred binding support.
public saveManyQuietly()
public saveManyQuietly($models, $sessionKey = null): void
saveManyQuietly saves multiple models without raising any events, with deferred binding support.
public saveQuietly()
public saveQuietly($model, $sessionKey = null): void
saveQuietly saves the supplied related model without raising any events, with deferred binding support.
public setSimpleValue()
public setSimpleValue($value): void
setSimpleValue helper for setting this relationship using various expected values. For example, $model->relation = $value;
public withDeferred()
public withDeferred(
string|null $sessionKey = null
): Illuminate\Database\Query\Builder
withDeferred returns a new model query with deferred bindings added, this will reset any constraints that come before it
public withDeferredQuery()
public withDeferredQuery(
Illuminate\Database\Query\Builder|null $newQuery = null,
string|null $sessionKey = null
): Illuminate\Database\Query\Builder
withDeferredQuery returns the supplied model query, or current model query, with deferred bindings added, this will preserve any constraints that came before it
Inherited Public Methods
- __call() - Handle dynamic method calls to the relationship. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- __callStatic() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- __clone() - Force a clone of the underlying query builder when cloning. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- addConstraints() - Set the base constraints on the relation query. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- addEagerConstraints() - (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- chaperone() - Instruct Eloquent to link the related models back to the parent after the relationship query has run. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- createdAt() - Get the name of the "created at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- enforceMorphMap() - Define the morph map for polymorphic relations and require all morphed models to be explicitly mapped. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- findOrNew() - Find a model by its primary key or return a new instance of the related model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- firstOrCreate() - Get the first record matching the attributes. If the record is not found, create it. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- firstOrNew() - Get the first related model record matching the attributes or instantiate it. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- flushMacros() - Flush the existing macros. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- forceCreate() - (defined in Illuminate\Database\Eloquent\Relations\MorphMany)
- forceCreateMany() - Create a Collection of new instances of the related model, allowing mass-assignment. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- forceCreateManyQuietly() - Create a Collection of new instances of the related model, allowing mass-assignment and without raising any events to the parent model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- get() - Execute the query as a "select" statement. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getBaseQuery() - Get the base query builder driving the Eloquent builder. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getEager() - Get the relationship for eager loading. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getExistenceCompareKey() - Get the key for comparing against the parent key in "has" query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getForeignKeyName() - Get the plain foreign key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getInverseRelationship() - Get the name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getLocalKeyName() - Get the local key for the relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getMorphAlias() - Get the alias associated with a custom polymorphic class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getMorphClass() - Get the morph class of the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getMorphType() - Get the plain morph type name without the table. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getMorphedModel() - Get the model associated with a custom polymorphic type. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getParent() - Get the parent model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getParentKey() - Get the key value of the parent's local key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQualifiedForeignKeyName() - Get the foreign key for the relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQualifiedMorphType() - Get the foreign key "type" name. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getQualifiedParentKeyName() - Get the fully-qualified parent key name. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getQuery() - Get the underlying query for the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelated() - Get the related model of the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelatedClass() - Get the class name of the related model. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationCountHash() - Get a relationship join table hash. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationExistenceCountQuery() - Add the constraints for a relationship count query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationExistenceQuery() - (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getRelationExistenceQueryForSelfRelation() - Add the constraints for a relationship query on the same table. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getResults() - (defined in Illuminate\Database\Eloquent\Relations\MorphMany)
- hasMacro() - Checks if macro is registered. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- incrementOrCreate() - Create a related record matching the attributes, or increment the existing record. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- initRelation() - (defined in Illuminate\Database\Eloquent\Relations\MorphMany)
- inverse() - Instruct Eloquent to link the related models back to the parent after the relationship query has run. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- limit() - Set the "limit" value of the query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- macro() - Register a custom macro. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- macroCall() - Dynamically handle calls to the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- make() - Create and return an un-saved instance of the related model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- makeMany() - Create and return an un-saved instance of the related models. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- match() - (defined in Illuminate\Database\Eloquent\Relations\MorphMany)
- matchMany() - Match the eagerly loaded results to their many parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- matchOne() - Match the eagerly loaded results to their single parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- mixin() - Mix another object into the class. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- morphMap() - Set or get the morph map for polymorphic relations. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- noConstraints() - Run a callback with constraints disabled on the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- noConstraintsForRelation() - Run a callback without constraints while preserving them for nested relation attributes. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- one() - Convert the relationship to a "morph one" relationship. (defined in Illuminate\Database\Eloquent\Relations\MorphMany)
- rawUpdate() - Run a raw update against the base query. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- relatedUpdatedAt() - Get the name of the related model's "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- requireMorphMap() - Prevent polymorphic relationships from being used without model mappings. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- requiresMorphMap() - Determine if polymorphic relationships require explicit model mapping. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- sole() - Execute the query and get the first result if it's the sole matching record. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- take() - Alias to set the "limit" value of the query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- toBase() - Get a base query builder instance. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- touch() - Touch all of the related models for the relationship. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- updateOrCreate() - Create or update a related record matching the attributes, and fill it with values. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- updatedAt() - Get the name of the "updated at" column. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- upsert() - Insert new records or update the existing ones. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- withConstraints() - Run a callback with constraints enabled on the relation. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withConstraintsForNestedRelation() - Run a callback with constraints when resolving a nested relation attribute. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withoutChaperone() - Remove the chaperone / inverse relationship for this query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- withoutInverse() - Remove the chaperone / inverse relationship for this query. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
Protected Methods
protected addPivotSiteScopeConstraints()
protected addPivotSiteScopeConstraints(): void
addPivotSiteScopeConstraints adds site_id constraint to pivot queries if enabled.
protected ensureRelationIsEmpty()
protected ensureRelationIsEmpty(): void
ensureRelationIsEmpty ensures the relation is empty, either deleted or nulled.
protected getPivotSiteScopeValue()
protected getPivotSiteScopeValue(): int|null
getPivotSiteScopeValue returns the current site_id value for pivot records. Returns null if pivotSiteScope is disabled, otherwise returns the site ID.
protected getRelationDefinitionForDefinedConstraints()
protected getRelationDefinitionForDefinedConstraints(): void
getRelationDefinitionForDefinedConstraints returns the relation definition for the relationship context.
protected getWithDeferredQualifiedKeyName()
protected getWithDeferredQualifiedKeyName( ): Illuminate\Database\Query\Expression
getWithDeferredQualifiedKeyName returns the related "slave id" key in a database friendly format.
protected isModelRemovable()
protected isModelRemovable($model): bool
isModelRemovable returns true if an existing model is already associated
Show inherited protected methods
Inherited Protected Methods
- applyInverseRelationToCollection() - Set the inverse relation on all models in a collection. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- applyInverseRelationToModel() - Set the inverse relation on a model. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- buildDictionary() - Build model dictionary keyed by the relation's foreign key. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- buildMorphMapFromModels() - Builds a table-keyed array from model class names. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- forwardCallTo() - Forward a method call to the given object. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- forwardDecoratedCallTo() - Forward a method call to the given object, returning $this if the forwarded call returned itself. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getDictionaryKey() - Get a dictionary key attribute - casting it to a string if necessary. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- getKeys() - Get all of the primary keys for an array of models. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getPossibleInverseRelations() - Get the possible inverse relations for the parent model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- getRelationQuery() - Get the query builder that will contain the relationship constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- getRelationValue() - Get the value of a relationship by one or many type. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- guessInverseRelation() - Guess the name of the inverse relationship. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- matchOneOrMany() - Match the eagerly loaded results to their many parents. (defined in Illuminate\Database\Eloquent\Relations\HasOneOrMany)
- setForeignAttributesForCreate() - Set the foreign ID and type for creating a related model. (defined in Illuminate\Database\Eloquent\Relations\MorphOneOrMany)
- throwBadMethodCallException() - Throw a bad method call exception for the given method. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- whereInEager() - Add a whereIn eager constraint for the given set of model keys to be loaded. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- whereInMethod() - Get the name of the "where in" method for eager loading. (defined in Illuminate\Database\Eloquent\Relations\Relation)
- withoutConstraints() - Run a callback with the configured relation constraints. (defined in Illuminate\Database\Eloquent\Relations\Relation)