BelongsToMany
class Winter\Storm\Database\Relations\BelongsToMany
extends Illuminate\Database\Eloquent\Relations\BelongsToMany
Extends
| Class | Description |
|---|---|
Illuminate\Database\Eloquent\Relations\BelongsToMany
|
Traits
| Trait | Description |
|---|---|
BelongsOrMorphsToMany
|
|
DeferOneOrMany
|
|
DefinedConstraints
|
Properties
inherited
public
$countMode
:
bool
= false
This relation object is a 'count' helper.
inherited
public
$orphanMode
:
bool
= false
When a join is not used, don't select aliased columns.
Methods
inherited
public
__construct (Winter\Storm\Database\Builder $query, Winter\Storm\Database\Model $parent, string $table, string $foreignPivotKey, string $relatedPivotKey, $parentKey, $relatedKey, string $relationName = null)
: void
Create a new belongs to many relationship instance.
| Property | Type | Description |
|---|---|---|
| $query | Winter\Storm\Database\Builder |
Winter\Storm\Database\Builder
|
| $parent | Winter\Storm\Database\Model |
Winter\Storm\Database\Model
|
| $table | string |
string
|
| $foreignPivotKey | string |
string
|
| $relatedPivotKey | string |
string
|
| $parentKey | mixed |
mixed
|
| $relatedKey | mixed |
mixed
|
| $relationName | string |
string
|
inherited
public
add (Illuminate\Database\Eloquent\Model $model, $sessionKey = null, array $pivotData = [])
Adds a model to this relationship type.
| Property | Type | Description |
|---|---|---|
| $model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
| $sessionKey | mixed |
mixed
|
| $pivotData | array |
array
|
inherited public addDefinedConstraints () : void
Set the defined constraints on the relation query.
inherited
public
addDefinedConstraintsToQuery (Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder $query, array | null $args = null)
Add query based constraints.
| Property | Type | Description |
|---|---|---|
| $query | Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder |
Illuminate\Database\Eloquent\Relations\Relation | Winter\Storm\Database\QueryBuilder
|
| $args | array | null |
array | null
|
inherited
public
addDefinedConstraintsToRelation (Illuminate\Database\Eloquent\Relations\Relation $relation, array | null $args = null)
Add relation based constraints.
| Property | Type | Description |
|---|---|---|
| $relation | Illuminate\Database\Eloquent\Relations\Relation |
Illuminate\Database\Eloquent\Relations\Relation
|
| $args | array | null |
array | null
|
inherited
public
allRelatedIds (string $sessionKey = null)
: Illuminate\Support\Collection
Get all of the IDs for the related models, with deferred binding support
| Property | Type | Description |
|---|---|---|
| $sessionKey | string |
string
|
inherited
public
attach (mixed $id, array $attributes = [], boolean $touch = true)
Override attach() method of BelongToMany relation.
This is necessary in order to fire 'model.relation.beforeAttach', 'model.relation.afterAttach' events
| Property | Type | Description |
|---|---|---|
| $id | mixed |
mixed
|
| $attributes | array |
array
|
| $touch | boolean |
boolean
|
inherited
public
create (array $attributes = [], array $pivotData = [], $sessionKey = null)
Create a new instance of this related model with deferred binding support.
| Property | Type | Description |
|---|---|---|
| $attributes | array |
array
|
| $pivotData | array |
array
|
| $sessionKey | mixed |
mixed
|
inherited
public
detach (Collection | Model | array | null $ids = null, boolean $touch = true)
: int | void
Override detach() method of BelongToMany relation.
This is necessary in order to fire 'model.relation.beforeDetach', 'model.relation.afterDetach' events
| Property | Type | Description |
|---|---|---|
| $ids | Collection | Model | array | null |
Collection | Model | array | null
|
| $touch | boolean |
boolean
|
inherited public getForeignKey () : string
Get the fully qualified foreign key for the relation.
inherited public getOtherKey () : string
Get the fully qualified "other key" for the relation.
inherited
public
getRelatedIds ($sessionKey = null)
| Property | Type | Description |
|---|---|---|
| $sessionKey | mixed |
mixed
|
inherited public getSimpleValue ()
Helper for getting this relationship simple value, generally useful with form values.
inherited
public
newPivot (array $attributes = [], boolean $exists = false)
: Illuminate\Database\Eloquent\Relations\Pivot
Create a new pivot model instance.
| Property | Type | Description |
|---|---|---|
| $attributes | array |
array
|
| $exists | boolean |
boolean
|
inherited
public
paginate (integer $perPage = 15, int $currentPage = null, array $columns = ["*"], string $pageName = "page")
: Illuminate\Contracts\Pagination\LengthAwarePaginator
Get a paginator for the "select" statement. Complies with Winter Storm.
| Property | Type | Description |
|---|---|---|
| $perPage | integer |
integer
|
| $currentPage | int |
int
|
| $columns | array |
array
|
| $pageName | string |
string
|
inherited
public
remove (Illuminate\Database\Eloquent\Model $model, $sessionKey = null)
Removes a model from this relationship type.
| Property | Type | Description |
|---|---|---|
| $model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
| $sessionKey | mixed |
mixed
|
inherited
public
save (Illuminate\Database\Eloquent\Model $model, array $pivotData = [], $sessionKey = null)
Save the supplied related model with deferred binding support.
| Property | Type | Description |
|---|---|---|
| $model | Illuminate\Database\Eloquent\Model |
Illuminate\Database\Eloquent\Model
|
| $pivotData | array |
array
|
| $sessionKey | mixed |
mixed
|
inherited public setSimpleValue ($value)
Helper for setting this relationship using various expected values. For example, $model->relation = $value;
| Property | Type | Description |
|---|---|---|
| $value | mixed |
mixed
|
inherited
public
simplePaginate (int | null $perPage = null, int | null $currentPage = null, array $columns = ["*"], string $pageName = "page")
: Illuminate\Contracts\Pagination\Paginator
Paginate the given query into a simple paginator.
| Property | Type | Description |
|---|---|---|
| $perPage | int | null |
int | null
|
| $currentPage | int | null |
int | null
|
| $columns | array |
array
|
| $pageName | string |
string
|
inherited
public
sync (array $ids, boolean $detaching = true)
: array
Override sync() method of BelongToMany relation in order to flush the query cache.
| Property | Type | Description |
|---|---|---|
| $ids | array |
array
|
| $detaching | boolean |
boolean
|
inherited public withDeferred ($sessionKey) : Illuminate\Database\Eloquent\Builder
Returns the model query with deferred bindings added
| Property | Type | Description |
|---|---|---|
| $sessionKey | mixed |
mixed
|
inherited protected getWithDeferredQualifiedKeyName () : Illuminate\Database\Query\Expression
Returns the related "slave id" key in a database friendly format.
inherited
protected
shouldSelect (array $columns = ["*"])
: array | string
Get the select columns for the relation query.
| Property | Type | Description |
|---|---|---|
| $columns | array |
array
|