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|nullgetItem()
Get item
public
getItem(int $documentId, int $productId) : Model|null
Parameters
- $documentId : int
- $productId : int
Return values
Model|nullgetItemCalc()
Get item calc closure
public
getItemCalc() : Closure
Return values
ClosuregetItemTotal()
Get document total
public
getItemTotal() : float
Return values
floatgetItemTotalAttribute()
item_total attribute
public
getItemTotalAttribute() : float
Return values
floatgetItemTotalAttributeName()
Get item total attribute
public
getItemTotalAttributeName() : string
Return values
stringhasItem()
Return true if item exist
public
hasItem(int $documentId, int $productId) : bool
Parameters
- $documentId : int
- $productId : int
Return values
boolsaveItem()
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
ModelscopeItemsQuery()
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
BuilderupdateDocumentTotals()
Updaet document totals
public
updateDocumentTotals() : bool