Arikaim CMS

PolymorphicRelations

Polymorphic Relations (Many To Many) trait

Table of Contents

Methods

deleteRelation()  : bool
Delete relation
deleteRelations()  : bool
Delete relations
getItemsQuery()  : Builder
Get relations
getRelatedItems()  : Collection|null
Get relations items
getRelationAttributeName()  : string|null
Get relation attribute name
getRelationModel()  : Model|false
Get relation
getRelationModelClass()  : string|null
Get relation model class
getRelationsQuery()  : Builder
Get relations query for model id
hasRelatedItems()  : bool
Return true if related items > 0
hasRelation()  : bool
Return true if relation exist
related()  : mixed
Morphed model
relations()  : Relation
Relations
saveRelation()  : Model|false
Save relation
saveRelations()  : array<string|int, mixed>
Save relations

Methods

deleteRelation()

Delete relation

public deleteRelation([int|string|null $id = null ]) : bool
Parameters
$id : int|string|null = null
Return values
bool

deleteRelations()

Delete relations

public deleteRelations(int|null $id[, string|null $type = null ][, int|null $relationId = null ]) : bool
Parameters
$id : int|null
$type : string|null = null
$relationId : int|null = null
Return values
bool

getItemsQuery()

Get relations

public getItemsQuery(int|null $id[, string|null $type = null ]) : Builder
Parameters
$id : int|null
$type : string|null = null
Return values
Builder

getRelatedItems()

Get relations items

public getRelatedItems(int|null $relationId[, string|null $type = null ]) : Collection|null
Parameters
$relationId : int|null
$type : string|null = null
Return values
Collection|null

getRelationAttributeName()

Get relation attribute name

public getRelationAttributeName() : string|null
Return values
string|null

getRelationModel()

Get relation

public getRelationModel(int|null $id, string|null $type, int|null $relationId) : Model|false
Parameters
$id : int|null
$type : string|null
$relationId : int|null
Return values
Model|false

getRelationModelClass()

Get relation model class

public getRelationModelClass() : string|null
Return values
string|null

getRelationsQuery()

Get relations query for model id

public getRelationsQuery(int|null $relationId[, string|null $type = null ]) : Builder
Parameters
$relationId : int|null
$type : string|null = null
Return values
Builder

hasRelatedItems()

Return true if related items > 0

public hasRelatedItems(int|null $id[, string|null $type = null ]) : bool
Parameters
$id : int|null
$type : string|null = null
Return values
bool

hasRelation()

Return true if relation exist

public hasRelation(int|null $id, string|null $type, int|null $relationId) : bool
Parameters
$id : int|null
$type : string|null
$relationId : int|null
Return values
bool

Morphed model

public related([string|null $type = null ]) : mixed
Parameters
$type : string|null = null

saveRelation()

Save relation

public saveRelation(int|null $id, string|null $type, int|null $relationId) : Model|false
Parameters
$id : int|null
$type : string|null
$relationId : int|null
Return values
Model|false

saveRelations()

Save relations

public saveRelations(array<string|int, mixed> $items, string|null $type, int|null $relationId) : array<string|int, mixed>
Parameters
$items : array<string|int, mixed>
$type : string|null
$relationId : int|null
Return values
array<string|int, mixed>

        
On this page

Search results