updated money
package to 5.0 version
This commit is contained in:
@ -64,7 +64,7 @@ class Currencies extends Controller
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$currency = config('money.' . $request->get('code'));
|
||||
$currency = config('money.currencies.' . $request->get('code'));
|
||||
|
||||
$request['precision'] = (int) $currency['precision'];
|
||||
$request['symbol'] = $currency['symbol'];
|
||||
|
@ -235,7 +235,7 @@ class Currencies extends Controller
|
||||
if ($code) {
|
||||
$currencies = Currency::all()->pluck('rate', 'code');
|
||||
|
||||
$currency = config('money.' . $code);
|
||||
$currency = config('money.currencies.' . $code);
|
||||
|
||||
$currency['rate'] = isset($currencies[$code]) ? $currencies[$code] : null;
|
||||
$currency['symbol_first'] = ! empty($currency['symbol_first']) ? 1 : 0;
|
||||
|
@ -84,7 +84,7 @@ class Money
|
||||
|
||||
$amount = $item['price'];
|
||||
|
||||
if (strpos($item['price'], config('money.' . $currency_code . '.symbol')) !== false) {
|
||||
if (strpos($item['price'], config('money.currencies.' . $currency_code . '.symbol')) !== false) {
|
||||
$amount = $this->getAmount($item['price'], $currency_code);
|
||||
}
|
||||
|
||||
@ -101,8 +101,8 @@ class Money
|
||||
protected function getAmount($money_format, $currency_code)
|
||||
{
|
||||
try {
|
||||
if (config('money.' . $currency_code . '.decimal_mark') !== '.') {
|
||||
$money_format = Str::replaceFirst('.', config('money.' . $currency_code . '.decimal_mark'), $money_format);
|
||||
if (config('money.currencies.' . $currency_code . '.decimal_mark') !== '.') {
|
||||
$money_format = Str::replaceFirst('.', config('money.currencies.' . $currency_code . '.decimal_mark'), $money_format);
|
||||
}
|
||||
|
||||
$amount = money($money_format, $currency_code)->getAmount();
|
||||
|
Reference in New Issue
Block a user