Arikaim CMS

DocumentItems

Document items table trait

Table of Contents

Methods

bootDocumentItems()  : void
Set model events
document()  : Relation|null
Document relation
getItem()  : Model|null
Get item
getItemCalc()  : Closure
Get item calc closure
getItemTotal()  : float
Get document total
getItemTotalAttribute()  : float
item_total attribute
getItemTotalAttributeName()  : string
Get item total attribute
hasItem()  : bool
Return true if item exist
saveItem()  : Model
Save item
scopeItemsQuery()  : Builder
Items query
updateDocumentTotals()  : bool
Updaet document totals

Methods

bootDocumentItems()

Set model events

public static bootDocumentItems() : void

document()

Document relation

public document() : Relation|null
Return values
Relation|null

getItem()

Get item

public getItem(int $documentId, int $productId) : Model|null
Parameters
$documentId : int
$productId : int
Return values
Model|null

getItemCalc()

Get item calc closure

public getItemCalc() : Closure
Return values
Closure

getItemTotal()

Get document total

public getItemTotal() : float
Return values
float

getItemTotalAttribute()

item_total attribute

public getItemTotalAttribute() : float
Return values
float

getItemTotalAttributeName()

Get item total attribute

public getItemTotalAttributeName() : string
Return values
string

hasItem()

Return true if item exist

public hasItem(int $documentId, int $productId) : bool
Parameters
$documentId : int
$productId : int
Return values
bool

saveItem()

Save item

public saveItem(int $documentId, int $productId, int $qty, float|null $price[, string|null $productName = null ]) : Model
Parameters
$documentId : int
$productId : int
$qty : int
$price : float|null
$productName : string|null = null
Return values
Model

scopeItemsQuery()

Items query

public scopeItemsQuery(Builder $query, int|null $documentId[, int|null $productId = null ]) : Builder
Parameters
$query : Builder
$documentId : int|null
$productId : int|null = null
Return values
Builder

updateDocumentTotals()

Updaet document totals

public updateDocumentTotals() : bool
Return values
bool

        
On this page

Search results