Methods |
public
|
toggle(mixed $ids, bool $touch = true): array
Toggles a model (or models) from the parent.
Toggles a model (or models) from the parent.
Each existing model is detached, and non existing ones are attached.
|
#
|
public
|
syncWithoutDetaching(Collection|Model|array $ids): array
Sync the intermediate tables with a list of IDs without detaching.
Sync the intermediate tables with a list of IDs without detaching.
|
#
|
public
|
sync(Collection|Model|array $ids, bool $detaching = true): array
Sync the intermediate tables with a list of IDs or collection of models.
Sync the intermediate tables with a list of IDs or collection of models.
|
#
|
public
|
syncWithPivotValues(Collection|Model|array $ids, array $values, bool $detaching = true): array
Sync the intermediate tables with a list of IDs or collection of models with the given pivot values.
Sync the intermediate tables with a list of IDs or collection of models with the given pivot values.
|
#
|
public
|
updateExistingPivot(mixed $id, array $attributes, bool $touch = true): int
Update an existing pivot record on the table.
Update an existing pivot record on the table.
|
#
|
public
|
attach(mixed $id, array $attributes = [], bool $touch = true): void
Attach a model to the parent.
Attach a model to the parent.
|
#
|
public
|
hasPivotColumn(string $column): bool
Determine whether the given column is defined as a pivot column.
Determine whether the given column is defined as a pivot column.
|
#
|
public
|
detach(mixed $ids = null, bool $touch = true): int
Detach models from the relationship.
Detach models from the relationship.
|
#
|
public
|
newPivot(array $attributes = [], bool $exists = false): Pivot
Create a new pivot model instance.
Create a new pivot model instance.
|
#
|
public
|
newExistingPivot(array $attributes = []): Pivot
Create a new existing pivot model instance.
Create a new existing pivot model instance.
|
#
|
public
|
newPivotStatement(): Builder
Get a new plain query builder for the pivot table.
Get a new plain query builder for the pivot table.
|
#
|
public
|
newPivotStatementForId(mixed $id): Builder
Get a new pivot statement for a given "other" ID.
Get a new pivot statement for a given "other" ID.
|
#
|
public
|
newPivotQuery(): Builder
Create a new query builder for the pivot table.
Create a new query builder for the pivot table.
|
#
|
public
|
withPivot(array|mixed $columns): $this
Set the columns on the pivot table to retrieve.
Set the columns on the pivot table to retrieve.
|
#
|