Methods |
public
|
__construct(Builder $query, Model $parent, string $foreignKey, string $localKey): void
Create a new has one or many relationship instance.
Create a new has one or many relationship instance.
Overrides
Overriden by
|
#
|
public
|
make(array $attributes = []): Model
Create and return an un-saved instance of the related model.
Create and return an un-saved instance of the related model.
|
#
|
public
|
makeMany(iterable $records): Collection
Create and return an un-saved instance of the related models.
Create and return an un-saved instance of the related models.
|
#
|
public
|
addConstraints(): void
Set the base constraints on the relation query.
Set the base constraints on the relation query.
Overriden by
Implements
|
#
|
public
|
addEagerConstraints(array $models): void
Set the constraints for an eager load of the relation.
Set the constraints for an eager load of the relation.
Overriden by
Implements
|
#
|
public
|
matchOne(array $models, Collection $results, string $relation): array
Match the eagerly loaded results to their single parents.
Match the eagerly loaded results to their single parents.
|
#
|
public
|
matchMany(array $models, Collection $results, string $relation): array
Match the eagerly loaded results to their many parents.
Match the eagerly loaded results to their many parents.
|
#
|
public
|
findOrNew(mixed $id, array $columns = ['*']): Collection|Model
Find a model by its primary key or return a new instance of the related model.
Find a model by its primary key or return a new instance of the related model.
|
#
|
public
|
firstOrNew(array $attributes = [], array $values = []): Model
Get the first related model record matching the attributes or instantiate it.
Get the first related model record matching the attributes or instantiate it.
|
#
|
public
|
firstOrCreate(array $attributes = [], array $values = []): Model
Get the first related record matching the attributes or create it.
Get the first related record matching the attributes or create it.
|
#
|
public
|
updateOrCreate(array $attributes, array $values = []): Model
Create or update a related record matching the attributes, and fill it with values.
Create or update a related record matching the attributes, and fill it with values.
|
#
|
public
|
save(Model $model): Model|false
Attach a model instance to the parent model.
Attach a model instance to the parent model.
|
#
|
public
|
saveMany(iterable $models): iterable
Attach a collection of models to the parent instance.
Attach a collection of models to the parent instance.
|
#
|
public
|
create(array $attributes = []): Model
Create a new instance of the related model.
Create a new instance of the related model.
|
#
|
public
|
forceCreate(array $attributes = []): Model
Create a new instance of the related model. Allow mass-assignment.
Create a new instance of the related model. Allow mass-assignment.
Overriden by
|
#
|
public
|
createMany(iterable $records): Collection
Create a Collection of new instances of the related model.
Create a Collection of new instances of the related model.
|
#
|
public
|
getRelationExistenceQuery(Builder $query, Builder $parentQuery, array|mixed $columns = ['*']): Builder
Add the constraints for a relationship query.
Add the constraints for a relationship query.
Overrides
Overriden by
|
#
|
public
|
getRelationExistenceQueryForSelfRelation(Builder $query, Builder $parentQuery, array|mixed $columns = ['*']): Builder
Add the constraints for a relationship query on the same table.
Add the constraints for a relationship query on the same table.
|
#
|
public
|
getExistenceCompareKey(): string
Get the key for comparing against the parent key in "has" query.
Get the key for comparing against the parent key in "has" query.
|
#
|
public
|
getParentKey(): mixed
Get the key value of the parent's local key.
Get the key value of the parent's local key.
|
#
|
public
|
getQualifiedParentKeyName(): string
Get the fully qualified parent key name.
Get the fully qualified parent key name.
Overrides
|
#
|
public
|
getForeignKeyName(): string
Get the plain foreign key.
Get the plain foreign key.
|
#
|
public
|
getQualifiedForeignKeyName(): string
Get the foreign key for the relationship.
Get the foreign key for the relationship.
|
#
|
public
|
getLocalKeyName(): string
Get the local key for the relationship.
Get the local key for the relationship.
|
#
|