LedgerCurrency
extends Model
in package
Uses
CommonResponseProperties, HasFactory
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
- checkRevision() : mixed
- createFromMessage() : self
- findOrBreaker() : LedgerCurrency
- Look for a currency. If not found throw a Breaker.
- 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
checkRevision()
public
checkRevision(string|null $revision) : mixed
Parameters
- $revision : string|null
Tags
Return values
mixed —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 —toResponse()
Convert to a response array.
public
toResponse([array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed> = []