Documentation

IsBillable

Don't use this Trait directly, but extend IsBillableAbstractClass

Table of Contents

$id  : int
$is_billable  : bool
$price_list_id  : int
$priceList  : PriceList
$priceListEntity  : PriceListEntity
$usage  : float
_isBillable()  : bool
This function is used to determinate if a model is ready to be billed.
_isBillableDirectly()  : bool
This function is used to determinate if a model is ready to be billed.
billingEntries()  : MorphMany
getBillableOwnerModel()  : Model
This function should be implemented by all models that are billable.
getCustomerProduct()  : CustomerProduct|null
This function should be implemented by all models that are billable.
getInvoiceItemDescription()  : string
This function should be implemented by all models that are billable.
priceList()  : BelongsTo
priceListEntity()  : MorphOne
promotionsCustomers()  : MorphMany
_getUsage()  : float
Called by the custom attribute `usage`. This function must be overwritten by the class that should implement how usage is calculated
billableHourly()  : Attribute
billableHourlyCost()  : Attribute
billableMonthly()  : Attribute
billableMonthlyCost()  : Attribute
billableMultiplier()  : Attribute
billableOneTime()  : Attribute
billableOneTimeCost()  : Attribute
billablePerUsage()  : Attribute
billablePerUsageCost()  : Attribute
billableUponRelation()  : Attribute
billableUponRelationClass()  : Attribute
billableUponRelationFk()  : Attribute
bootIsBillable()  : void
usage()  : Attribute
`usage` custom attribute (only getter).

Properties

Methods

_isBillable()

This function is used to determinate if a model is ready to be billed.

public _isBillable([bool|null $originIsBillable = null ]) : bool

Should be overwritten by models that needs a custom logic. If a model do not specialize this function the provided parameter will be returned, otherwise the attribute of the model. IMPORTANT!!! In the specialized version of this function always check the provided parameter, as in some cases a model may have been set on is_billable = false

Parameters
$originIsBillable : bool|null = null
Return values
bool

_isBillableDirectly()

This function is used to determinate if a model is ready to be billed.

public _isBillableDirectly([bool $originIsBillableDirectly = null ]) : bool

Should be overwritten by models that needs a custom logic. If a model do not specialize this function the provided parameter will be returned, otherwise the attribute of the model. IMPORTANT!!! In the specialized version of this function always check the provided parameter, as in some cases a model may have been set on is_billable = false

Parameters
$originIsBillableDirectly : bool = null
Return values
bool

billingEntries()

public billingEntries() : MorphMany
Return values
MorphMany

getBillableOwnerModel()

This function should be implemented by all models that are billable.

public abstract getBillableOwnerModel() : Model

It should return the reference to the main object which is the owner of the billable entity This SHOULD ALWAYS return a model, if there is no owner just return the model itself.

Return values
Model

getInvoiceItemDescription()

This function should be implemented by all models that are billable.

public abstract getInvoiceItemDescription([array<string|int, mixed> $changes = [] ]) : string

It should return the description to be used in the invoice item

Parameters
$changes : array<string|int, mixed> = []
Return values
string

priceList()

public priceList() : BelongsTo
Return values
BelongsTo

priceListEntity()

public priceListEntity() : MorphOne
Return values
MorphOne

promotionsCustomers()

public promotionsCustomers() : MorphMany
Return values
MorphMany

_getUsage()

Called by the custom attribute `usage`. This function must be overwritten by the class that should implement how usage is calculated

protected _getUsage() : float
Return values
float

billableHourly()

protected billableHourly() : Attribute
Return values
Attribute

billableHourlyCost()

protected billableHourlyCost() : Attribute
Return values
Attribute

billableMonthly()

protected billableMonthly() : Attribute
Return values
Attribute

billableMonthlyCost()

protected billableMonthlyCost() : Attribute
Return values
Attribute

billableMultiplier()

protected billableMultiplier() : Attribute
Return values
Attribute

billableOneTime()

protected billableOneTime() : Attribute
Return values
Attribute

billableOneTimeCost()

protected billableOneTimeCost() : Attribute
Return values
Attribute

billablePerUsage()

protected billablePerUsage() : Attribute
Return values
Attribute

billablePerUsageCost()

protected billablePerUsageCost() : Attribute
Return values
Attribute

billableUponRelation()

protected billableUponRelation() : Attribute
Return values
Attribute

billableUponRelationClass()

protected billableUponRelationClass() : Attribute
Return values
Attribute

billableUponRelationFk()

protected billableUponRelationFk() : Attribute
Return values
Attribute

usage()

`usage` custom attribute (only getter).

protected usage() : Attribute

It returns the current usage of the entity for billable purpose.

Return values
Attribute

float Usage

Search results