LedgerCurrency
extends Model
in package
Uses
CommonResponseProperties, HasFactory, HasRevisions
Currencies available to the ledger.
Tags
Table of Contents
- AMOUNT_SIZE = 32
- CODE_SIZE = 16
- $code : string
- $created_at : Carbon
- $decimals : int
- $incrementing : mixed
- $primaryKey : mixed
- $revision : Carbon
- $updated_at : Carbon
- __get() : HigherOrderCollectionProxy|mixed|string|null
- The revision Hash is computationally expensive, only calculated when required.
- checkRevision() : mixed
- Throw a Breaker exception if the request revision doesn't match the stored value.
- clearRevisionCache() : void
- createFromMessage() : self
- findOrBreaker() : LedgerCurrency
- Look for a currency. If not found throw a Breaker.
- getRevisionHash() : mixed
- refresh() : mixed
- toResponse() : array<string|int, mixed>
- Convert to a response array.
Constants
AMOUNT_SIZE
public
mixed
AMOUNT_SIZE
= 32
CODE_SIZE
public
mixed
CODE_SIZE
= 16
Properties
$code
public
string
$code
The currency code.
$created_at
public
Carbon
$created_at
When the record was created.
$decimals
public
int
$decimals
The number of decimals to carry.
$incrementing
public
mixed
$incrementing
= false
$primaryKey
public
mixed
$primaryKey
= 'code'
$revision
public
Carbon
$revision
Revision timestamp to detect race condition on update.
$updated_at
public
Carbon
$updated_at
When the record was updated.
Methods
__get()
The revision Hash is computationally expensive, only calculated when required.
public
__get( $key) : HigherOrderCollectionProxy|mixed|string|null
Parameters
Tags
Return values
HigherOrderCollectionProxy|mixed|string|null —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
Return values
mixed —clearRevisionCache()
public
clearRevisionCache() : void
Return values
void —createFromMessage()
public
static createFromMessage(Currency $message) : self
Parameters
- $message : Currency
Return values
self —findOrBreaker()
Look for a currency. If not found throw a Breaker.
public
static findOrBreaker(string $currency[, int|null $errorCode = Breaker::BAD_REQUEST ]) : LedgerCurrency
Parameters
- $currency : string
-
Currency code.
- $errorCode : int|null = Breaker::BAD_REQUEST
-
Breaker code (default to bad request).
Tags
Return values
LedgerCurrency —getRevisionHash()
public
getRevisionHash() : mixed
Return values
mixed —refresh()
public
refresh() : mixed
Return values
mixed —toResponse()
Convert to a response array.
public
toResponse([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed> = []