Contents

October\Rain\Database\Relations\MorphOneOrMany


Protected Properties

protected string $relationName

relationName is the "name" of the relationship.


Public Methods

public add()

public add($model, $sessionKey = null): void

add a model to this relationship type.

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 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 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

Protected Methods

protected ensureRelationIsEmpty()

protected ensureRelationIsEmpty(): void

ensureRelationIsEmpty ensures the relation is empty, either deleted or nulled.

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