updated money
package to 5.0 version
This commit is contained in:
@ -319,7 +319,7 @@ class Transaction extends Model
|
||||
// Convert amount if not same currency
|
||||
if ($this->account->currency_code != $this->currency_code) {
|
||||
$to_code = $this->account->currency_code;
|
||||
$to_rate = config('money.' . $this->account->currency_code . '.rate');
|
||||
$to_rate = config('money.currencies.' . $this->account->currency_code . '.rate');
|
||||
|
||||
$amount = $this->convertBetween($amount, $this->currency_code, $this->currency_rate, $to_code, $to_rate);
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ class Document extends Model
|
||||
|
||||
$code = $this->currency_code;
|
||||
$rate = $this->currency_rate;
|
||||
$precision = config('money.' . $code . '.precision');
|
||||
$precision = config('money.currencies.' . $code . '.precision');
|
||||
|
||||
if ($this->transactions->count()) {
|
||||
foreach ($this->transactions as $transaction) {
|
||||
@ -361,7 +361,7 @@ class Document extends Model
|
||||
|
||||
$code = $this->currency_code;
|
||||
$rate = $this->currency_rate;
|
||||
$precision = config('money.' . $code . '.precision');
|
||||
$precision = config('money.currencies.' . $code . '.precision');
|
||||
|
||||
if ($this->transactions->count()) {
|
||||
foreach ($this->transactions as $transaction) {
|
||||
@ -391,7 +391,7 @@ class Document extends Model
|
||||
*/
|
||||
public function getAmountDueAttribute()
|
||||
{
|
||||
$precision = config('money.' . $this->currency_code . '.precision');
|
||||
$precision = config('money.currencies.' . $this->currency_code . '.precision');
|
||||
|
||||
return round($this->amount - $this->paid, $precision);
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ class Currency extends Model
|
||||
public function getPrecisionAttribute($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return config('money.' . $this->code . '.precision');
|
||||
return config('money.currencies.' . $this->code . '.precision');
|
||||
}
|
||||
|
||||
return (int) $value;
|
||||
@ -136,7 +136,7 @@ class Currency extends Model
|
||||
public function getSymbolAttribute($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return config('money.' . $this->code . '.symbol');
|
||||
return config('money.currencies.' . $this->code . '.symbol');
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -150,7 +150,7 @@ class Currency extends Model
|
||||
public function getSymbolFirstAttribute($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return config('money.' . $this->code . '.symbol_first');
|
||||
return config('money.currencies.' . $this->code . '.symbol_first');
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -164,7 +164,7 @@ class Currency extends Model
|
||||
public function getDecimalMarkAttribute($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return config('money.' . $this->code . '.decimal_mark');
|
||||
return config('money.currencies.' . $this->code . '.decimal_mark');
|
||||
}
|
||||
|
||||
return $value;
|
||||
@ -178,7 +178,7 @@ class Currency extends Model
|
||||
public function getThousandsSeparatorAttribute($value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return config('money.' . $this->code . '.thousands_separator');
|
||||
return config('money.currencies.' . $this->code . '.thousands_separator');
|
||||
}
|
||||
|
||||
return $value;
|
||||
|
Reference in New Issue
Block a user