Currency
A currency.
    class
    Currency        extends AbstractModel        implements
        CurrencyInterface
        
                    Constants
| DEFAULT_CURRENCY_ID | 
 | 
Properties summary
| Type | Property | Description | |
|---|---|---|---|
| protected | $table | ||
| $timestamps | |||
| protected | $fillable | Define the fields that can be hydrated by a firstOrNew call. | |
| integer | $id | ||
| string | $code | ||
| string | $prefix | ||
| string | $suffix | ||
| integer | $format | ||
| float | $rate | ||
| boolean | $default | 
Methods summary
| Return Type | Method Name | Description | |
|---|---|---|---|
| static | boot() | - | |
| scopeDefaultCurrency($query) | - | ||
| Builder | scopeCode(Builder $query, string $code) | - | |
| Builder | scopeDefaultSorting(Builder $query) | Show default currency first, and all other currencies sorted by currency code. | |
| static | validateCurrencyCode($currencyCode) | - | |
| static | factoryForClientArea() | - | |
| float | convertTo(float $amount, Currency $currency) | - | |
| static float | convertBetween(CurrencyInterface $fromCurrency, float $amount, CurrencyInterface $toCurrency) | Convert amount between currencies | |
| string | getCode() | - | |
| Currency | setCode(string $code) | - | |
| float | getRate() | - | |
| Currency | setRate(float $rate) | - | |
| array | nonFractionalCurrencyCodes() | - | |
| bool | isNonFractionalCurrency() | - | |
| float | valueInCurrencyPrecision(float $amount) | Yield a value that reflects the Currency's support for fractional amounts. | 
Details
                static            
    boot ()
        
    
    
                            
    scopeDefaultCurrency ($query)
        
    
    
                            Builder
    scopeCode (Builder $query, string $code)
        
    
    
                            Builder
    scopeDefaultSorting (Builder $query)
        
    
    Show default currency first, and all other currencies sorted by currency code.
                static            
    validateCurrencyCode ($currencyCode)
        
    
    
                static            
    factoryForClientArea ()
        
    
    
                            float
    convertTo (float $amount, Currency $currency)
        
    
    
                static            float
    convertBetween (CurrencyInterface $fromCurrency, float $amount, CurrencyInterface $toCurrency)
        
    
    Convert amount between currencies
                            string
    getCode ()
        
    
    
                            Currency
    setCode (string $code)
        
    
    
                            float
    getRate ()
        
    
    
                            Currency
    setRate (float $rate)
        
    
    
                            array
    nonFractionalCurrencyCodes ()
        
    
    
                            bool
    isNonFractionalCurrency ()
        
    
    
                            float
    valueInCurrencyPrecision (float $amount)
        
    
    Yield a value that reflects the Currency's support for fractional amounts.
This makes no attempt to return a value that match the actual fractional precision for fraction supporting Currency. For example in the Currency is USD, and 1.666 is provided, 1.666 is returned. If the Currency is JPY for that same amount, 2.00 will be returned.
Note, even if this is a non-fractional currency, a float is returned for consistency.