trait SupportsInverseRelations

Properties

protected string|null $inverseRelationship

The name of the inverse relationship.

Methods

inverse(string|null $relation = null)

Instruct Eloquent to link the related models back to the parent after the relationship query has run.

chaperone(string|null $relation = null)

Instruct Eloquent to link the related models back to the parent after the relationship query has run.

string|null
guessInverseRelation()

Guess the name of the inverse relationship.

array
getPossibleInverseRelations()

Get the possible inverse relations for the parent model.

mixed
applyInverseRelationToCollection(mixed $models, Model|null $parent = null)

Set the inverse relation on all models in a collection.

applyInverseRelationToModel(Model $model, Model|null $parent = null)

Set the inverse relation on a model.

string|null
getInverseRelationship()

Get the name of the inverse relationship.

withoutInverse()

Remove the chaperone / inverse relationship for this query.

withoutChaperone()

Remove the chaperone / inverse relationship for this query.

Details

at line 26
SupportsInverseRelations inverse(string|null $relation = null)

Instruct Eloquent to link the related models back to the parent after the relationship query has run.

Alias of "chaperone".

Parameters

string|null $relation

Return Value

SupportsInverseRelations

at line 36
SupportsInverseRelations chaperone(string|null $relation = null)

Instruct Eloquent to link the related models back to the parent after the relationship query has run.

Parameters

string|null $relation

Return Value

SupportsInverseRelations

at line 60
protected string|null guessInverseRelation()

Guess the name of the inverse relationship.

Return Value

string|null

at line 73
protected array getPossibleInverseRelations()

Get the possible inverse relations for the parent model.

Return Value

array

at line 91
protected mixed applyInverseRelationToCollection(mixed $models, Model|null $parent = null)

Set the inverse relation on all models in a collection.

Parameters

mixed $models
Model|null $parent

Return Value

mixed

at line 106
protected Model applyInverseRelationToModel(Model $model, Model|null $parent = null)

Set the inverse relation on a model.

Parameters

Model $model
Model|null $parent

Return Value

Model

at line 120
string|null getInverseRelationship()

Get the name of the inverse relationship.

Return Value

string|null

at line 132
SupportsInverseRelations withoutInverse()

Remove the chaperone / inverse relationship for this query.

Alias of "withoutChaperone".

at line 142
SupportsInverseRelations withoutChaperone()

Remove the chaperone / inverse relationship for this query.