Documentation

LedgerAccount extends Model
in package
Uses CommonResponseProperties, HasFactory, HasNames, HasRevisions, UuidPrimaryKey

Ledger Account Definition

Tags
mixin

Builder

mixin

\Illuminate\Database\Query\Builder

Table of Contents

CODE_SIZE  = 32
$category  : bool
$closed  : bool
$code  : string
$created_at  : Carbon
$credit  : bool
$debit  : bool
$extra  : object
$flex  : object
$incrementing  : bool
$ledgerUuid  : string
$names  : array<string|int, LedgerName>
$parentCode  : string
$parentUuid  : string
$revision  : Carbon
$revisionHash  : string
$taxCode  : string
$updated_at  : Carbon
__get()  : HigherOrderCollectionProxy|mixed|string|null
Getting the parent code requires fetching the parent; The revision Hash is computationally expensive, only calculated when required.
__set()  : mixed
balances()  : HasMany
checkRevision()  : mixed
Throw a Breaker exception if the request revision doesn't match the stored value.
clearRevisionCache()  : void
createFromMessage()  : self
entityRef()  : EntityRef
findWith()  : Builder
getFlexAttribute()  : Flex
getRevisionHash()  : mixed
getSubAccountList()  : array<string|int, string>
Get a list of this account ID and all subaccount IDs.
hasRoot()  : bool
Check if the ledger root singleton exists.
loadRoot()  : void
matchesEntity()  : bool
nameIn()  : string
names()  : HasMany
notInitializedError()  : void
Throw a missing root error.
parentPath()  : array<string|int, LedgerAccount>
Get the path to the root for an account, optionally checking for an external circular reference.
refresh()  : mixed
resetRules()  : LedgerRules
Merge data into the rule set.
root()  : LedgerAccount
Get the ledger root singleton, loading it if required.
rules()  : LedgerRules|null
Get the current rule set. During ledger creation, this is a set of bootstrap rules.
saveRoot()  : LedgerAccount|null
Save and return the root settings, if they exist.
setFlexAttribute()  : void
setRules()  : LedgerRules
Merge data into the rule set.
systemDateFormat()  : string
toMessage()  : Account
toResponse()  : array<string|int, mixed>
Convert to an array suitable for returning as a response.
whereEntity()  : Builder
Add or create a where clause for accounts matching an EntityRef.

Constants

Properties

$category

public bool $category

Set if this is a category account (no transactions/balances).

$closed

public bool $closed

Set if this account is closed to further transactions.

$code

public string $code

The application code (chart of accounts code) for this account.

$created_at

public Carbon $created_at

When the record was created.

$credit

public bool $credit

Set when this is a credit-side account.

$debit

public bool $debit

Set when this is a debit-side account.

$extra

public object $extra

Additional application level information.

$flex

public object $flex

JSON-formatted internal information (via accessor).

$incrementing

public bool $incrementing = false

Override incrementing primary key.

$parentCode read-only

public string $parentCode

The parent account code (or null if this is the root).

$parentUuid

public string $parentUuid

The parent account (or null if this is the root).

$revision

public Carbon $revision

Revision timestamp to detect race condition on update.

$revisionHash

public string $revisionHash

Salted hash of $revision.

$taxCode

public string $taxCode

An account code for tax purposes.

$updated_at

public Carbon $updated_at

When the record was updated.

Methods

__get()

Getting the parent code requires fetching the parent; The revision Hash is computationally expensive, only calculated when required.

public __get( $key) : HigherOrderCollectionProxy|mixed|string|null
Parameters
$key :
Tags
throws
Exception
Return values
HigherOrderCollectionProxy|mixed|string|null

__set()

public __set(mixed $key, mixed $value) : mixed
Parameters
$key : mixed
$value : mixed
Return values
mixed

balances()

public balances() : HasMany
Return values
HasMany

checkRevision()

Throw a Breaker exception if the request revision doesn't match the stored value.

public checkRevision(string|null $revision) : mixed
Parameters
$revision : string|null
Tags
throws
Breaker
Return values
mixed

clearRevisionCache()

public clearRevisionCache() : void
Return values
void

createFromMessage()

public static createFromMessage(Account $message) : self
Parameters
$message : Account
Return values
self

findWith()

public static findWith(EntityRef $entityRef) : Builder
Parameters
$entityRef : EntityRef
Tags
throws
Exception
noinspection

PhpIncompatibleReturnTypeInspection

noinspection

PhpDynamicAsStaticMethodCallInspection

Return values
Builder

getFlexAttribute()

public getFlexAttribute(mixed $value) : Flex
Parameters
$value : mixed
Tags
throws
HydrationException
Return values
Flex

getRevisionHash()

public getRevisionHash() : mixed
Return values
mixed

getSubAccountList()

Get a list of this account ID and all subaccount IDs.

public getSubAccountList() : array<string|int, string>
Return values
array<string|int, string>

hasRoot()

Check if the ledger root singleton exists.

public static hasRoot() : bool
Return values
bool

loadRoot()

public static loadRoot() : void
Return values
void

nameIn()

public nameIn(mixed $languages) : string
Parameters
$languages : mixed
Return values
string

names()

public names() : HasMany
Return values
HasMany

notInitializedError()

Throw a missing root error.

public static notInitializedError() : void
Tags
throws
Breaker
Return values
void

parentPath()

Get the path to the root for an account, optionally checking for an external circular reference.

public static parentPath(EntityRef $start, EntityRef|null $lookFor) : array<string|int, LedgerAccount>
Parameters
$start : EntityRef
$lookFor : EntityRef|null
Tags
throws
Breaker

If a circular reference is found.

throws
Exception
Return values
array<string|int, LedgerAccount>

Account parents from $start up to the root.

refresh()

public refresh() : mixed
Return values
mixed

rules()

Get the current rule set. During ledger creation, this is a set of bootstrap rules.

public static rules([bool $bootable = false ][, bool $required = true ]) : LedgerRules|null
Parameters
$bootable : bool = false

True if a base rule set should be returned if no root exists.

$required : bool = true

True if a root rule set must exist (throws Breaker instead of returning null).

Tags
throws
Breaker
Return values
LedgerRules|null

setFlexAttribute()

public setFlexAttribute(mixed $value) : void
Parameters
$value : mixed
Tags
phpcsSuppress

ForbiddenSetterSniff

noinspection

PhpUnused

Return values
void

systemDateFormat()

public static systemDateFormat() : string
Return values
string

toResponse()

Convert to an array suitable for returning as a response.

public toResponse([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$options : array<string|int, mixed> = []
Tags
throws
Exception
Return values
array<string|int, mixed>

Properties to be sent in the response.

whereEntity()

Add or create a where clause for accounts matching an EntityRef.

public static whereEntity(string $operator, EntityRef $entityRef[, Builder|Builder|null $query = null ]) : Builder
Parameters
$operator : string

The SQL operator to ise.

$entityRef : EntityRef

The entity to apply the operator to.

$query : Builder|Builder|null = null

An existing query.

Tags
throws
Exception
Return values
Builder

The query builder.

Search results