MorphManySyncable extends MorphMany Uses Syncable
A MorphMany relationship that constrains on the value of an additional foreign key in the pivot table.
Tags
Table of Contents
sync() | Synchronizes an array of data for related models with a parent model. | mixed |
---|---|---|
castKeys() | Cast the given keys to integers if they are numeric and string otherwise. | array |
castKey() | Cast the given key to an integer if it is numeric. | mixed |
Methods
sync()
Synchronizes an array of data for related models with a parent model.
public
sync(
$data :
array
[, $deleting :
bool
= true ]
[, $forceCreate :
bool
= false ]
[, $relatedKeyName :
string
= null ]
)
: mixed
Parameters
- $data : array
- $deleting : bool = true
Delete models from the database that are not represented in the input data.
- $forceCreate : bool = false
Ignore mass assignment restrictions on child models.
- $relatedKeyName : string = null
The primary key used to determine which child models are new, updated, or deleted.
Return values
mixedcastKeys()
Cast the given keys to integers if they are numeric and string otherwise.
protected
castKeys(
$keys :
array
)
: array
Parameters
- $keys : array
Return values
arraycastKey()
Cast the given key to an integer if it is numeric.
protected
castKey(
$key :
mixed
)
: mixed
Parameters
- $key : mixed