UserFrosting API

MorphManySyncable extends MorphMany Uses Syncable

A MorphMany relationship that constrains on the value of an additional foreign key in the pivot table.

Tags
author

Alex Weissman (https://alexanderweissman.com)

see
https://github.com/laravel/framework/blob/5.8/src/Illuminate/Database/Eloquent/Relations/MorphMany.php

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
mixed

castKeys()

Cast the given keys to integers if they are numeric and string otherwise.

protected castKeys( $keys : array ) : array
Parameters
$keys : array
Return values
array

castKey()

Cast the given key to an integer if it is numeric.

protected castKey( $key : mixed ) : mixed
Parameters
$key : mixed
Return values
mixed

Search results