BelongsToMany
class BelongsToMany extends BelongsToMany
Adapted from october\rain\database\relations\BelongsToMany
Traits
Adapted from october\rain\database\relations\DeferOneOrMany
Properties
bool | $countMode | ||
bool | $orphanMode |
Methods
Returns the model query with deferred bindings added
Returns the related "slave id" key in a database friendly format.
Set the defined constraints on the relation query.
Add relation based constraints.
Create a new belongs to many relationship instance.
Get the select columns for the relation query.
Save the supplied related model with deferred binding support.
Override sync() method of BelongToMany relation in order to flush the query cache.
Create a new instance of this related model with deferred binding support.
Override attach() method of BelongToMany relation.
Override detach() method of BelongToMany relation.
Adds a model to this relationship type.
Removes a model from this relationship type.
Get a paginator for the "select" statement. Complies with October Rain.
Create a new pivot model instance.
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
Helper for getting this relationship simple value, generally useful with form values.
Get all of the IDs for the related models, with deferred binding support
Get the fully qualified foreign key for the relation.
Get the fully qualified "other key" for the relation.
Details
in
DeferOneOrMany at line 17
Builder
withDeferred($sessionKey)
Returns the model query with deferred bindings added
in
DeferOneOrMany at line 125
protected Expression
getWithDeferredQualifiedKeyName()
Returns the related "slave id" key in a database friendly format.
in
DefinedConstraints at line 20
void
addDefinedConstraints()
Set the defined constraints on the relation query.
in
DefinedConstraints at line 35
addDefinedConstraintsToRelation(Relation $relation, array $args = null)
Add relation based constraints.
in
DefinedConstraints at line 85
addDefinedConstraintsToQuery(Builder $query, array $args = null)
Add query based constraints.
at line 39
void
__construct(Builder $query, Model $parent, string $table, string $foreignPivotKey, string $relatedPivotKey, $parentKey, $relatedKey, string $relationName = null)
Create a new belongs to many relationship instance.
at line 69
protected BelongsToMany
shouldSelect(array $columns = ['*'])
Get the select columns for the relation query.
at line 89
save(Model $model, array $pivotData = [], $sessionKey = null)
Save the supplied related model with deferred binding support.
at line 103
array
sync(array $ids, bool $detaching = true)
Override sync() method of BelongToMany relation in order to flush the query cache.
at line 112
create(array $attributes = [], array $pivotData = [], $sessionKey = null)
Create a new instance of this related model with deferred binding support.
at line 128
attach(mixed $id, array $attributes = [], bool $touch = true)
Override attach() method of BelongToMany relation.
This is necessary in order to fire 'model.relation.beforeAttach', 'model.relation.afterAttach' events
at line 179
int|void
detach(null $ids = null, bool $touch = true)
Override detach() method of BelongToMany relation.
This is necessary in order to fire 'model.relation.beforeDetach', 'model.relation.afterDetach' events
at line 224
add(Model $model, $sessionKey = null, $pivotData = [])
Adds a model to this relationship type.
at line 243
remove(Model $model, $sessionKey = null)
Removes a model from this relationship type.
at line 263
LengthAwarePaginator
paginate(int $perPage = 15, int $currentPage = null, array $columns = ['*'], string $pageName = 'page')
Get a paginator for the "select" statement. Complies with October Rain.
at line 281
Pivot
newPivot(array $attributes = [], bool $exists = false)
Create a new pivot model instance.
at line 302
setSimpleValue($value)
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
at line 362
getSimpleValue()
Helper for getting this relationship simple value, generally useful with form values.
at line 388
Collection
allRelatedIds(string $sessionKey = null)
Get all of the IDs for the related models, with deferred binding support
at line 404
string
getForeignKey()
Get the fully qualified foreign key for the relation.
at line 414
string
getOtherKey()
Get the fully qualified "other key" for the relation.