diff --git a/src/Console/Hydrate.php b/src/Console/Hydrate.php index 7e0e278..eaa8bf9 100644 --- a/src/Console/Hydrate.php +++ b/src/Console/Hydrate.php @@ -37,6 +37,959 @@ class Hydrate extends Command */ protected $currencies; + protected $rates = + [ + + 'AED' => [ + 'name' => 'UAE Dirham', + 'symbol' => 'دإ‏', + 'format' => 'دإ‏ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'AFN' => [ + 'name' => 'Afghanistan, Afghani', + 'symbol' => '؋', + 'format' => '؋1,0.00', + 'exchange_rate' => 0.00, + ], + 'ALL' => [ + 'name' => 'Albania, Lek', + 'symbol' => 'Lek', + 'format' => '1,0.00Lek', + 'exchange_rate' => 0.00, + ], + 'AMD' => [ + 'name' => 'Armenian Dram', + 'symbol' => '֏', + 'format' => '1,0.00 ֏', + 'exchange_rate' => 0.00, + ], + 'ANG' => [ + 'name' => 'Netherlands Antillian Guilder', + 'symbol' => 'ƒ', + 'format' => 'ƒ1,0.00', + 'exchange_rate' => 0.00, + ], + 'AOA' => [ + 'name' => 'Angola, Kwanza', + 'symbol' => 'Kz', + 'format' => 'Kz1,0.00', + 'exchange_rate' => 0.00, + ], + 'ARS' => [ + 'name' => 'Argentine Peso', + 'symbol' => '$', + 'format' => '$ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'AUD' => [ + 'name' => 'Australian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'AWG' => [ + 'name' => 'Aruban Guilder', + 'symbol' => 'ƒ', + 'format' => 'ƒ1,0.00', + 'exchange_rate' => 0.00, + ], + 'AZN' => [ + 'name' => 'Azerbaijanian Manat', + 'symbol' => '₼', + 'format' => '1 0,00 ₼', + 'exchange_rate' => 0.00, + ], + 'BAM' => [ + 'name' => 'Bosnia and Herzegovina, Convertible Marks', + 'symbol' => 'КМ', + 'format' => '1,0.00 КМ', + 'exchange_rate' => 0.00, + ], + 'BBD' => [ + 'name' => 'Barbados Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'BDT' => [ + 'name' => 'Bangladesh, Taka', + 'symbol' => '৳', + 'format' => '৳ 1,0.', + 'exchange_rate' => 0.00, + ], + 'BGN' => [ + 'name' => 'Bulgarian Lev', + 'symbol' => 'лв.', + 'format' => '1 0,00 лв.', + 'exchange_rate' => 0.00, + ], + 'BHD' => [ + 'name' => 'Bahraini Dinar', + 'symbol' => '.د.', + 'format' => '.د. 1,0.000', + 'exchange_rate' => 0.00, + ], + 'BIF' => [ + 'name' => 'Burundi Franc', + 'symbol' => 'FBu', + 'format' => '1,0.FBu', + 'exchange_rate' => 0.00, + ], + 'BMD' => [ + 'name' => 'Bermudian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'BND' => [ + 'name' => 'Brunei Dollar', + 'symbol' => '$', + 'format' => '$1,0.', + 'exchange_rate' => 0.00, + ], + 'BOB' => [ + 'name' => 'Bolivia, Boliviano', + 'symbol' => 'Bs', + 'format' => 'Bs 1,0.00', + 'exchange_rate' => 0.00, + ], + 'BRL' => [ + 'name' => 'Brazilian Real', + 'symbol' => 'R$', + 'format' => 'R$ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'BSD' => [ + 'name' => 'Bahamian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'BTN' => [ + 'name' => 'Bhutan, Ngultrum', + 'symbol' => 'Nu.', + 'format' => 'Nu. 1,0.0', + 'exchange_rate' => 0.00, + ], + 'BWP' => [ + 'name' => 'Botswana, Pula', + 'symbol' => 'P', + 'format' => 'P1,0.00', + 'exchange_rate' => 0.00, + ], + 'BYN' => [ + 'name' => 'Belarussian Ruble', + 'symbol' => 'р.', + 'format' => '1 0,00 р.', + 'exchange_rate' => 0.00, + ], + 'BZD' => [ + 'name' => 'Belize Dollar', + 'symbol' => 'BZ$', + 'format' => 'BZ$1,0.00', + 'exchange_rate' => 0.00, + ], + 'CAD' => [ + 'name' => 'Canadian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'CDF' => [ + 'name' => 'Franc Congolais', + 'symbol' => 'FC', + 'format' => '1,0.00FC', + 'exchange_rate' => 0.00, + ], + 'CHF' => [ + 'name' => 'Swiss Franc', + 'symbol' => 'CHF', + 'format' => '1\'0.00 CHF', + 'exchange_rate' => 0.00, + ], + 'CLP' => [ + 'name' => 'Chilean Peso', + 'symbol' => '$', + 'format' => '$ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'CNY' => [ + 'name' => 'China Yuan Renminbi', + 'symbol' => '¥', + 'format' => '¥1,0.00', + 'exchange_rate' => 0.00, + ], + 'COP' => [ + 'name' => 'Colombian Peso', + 'symbol' => '$', + 'format' => '$ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'CRC' => [ + 'name' => 'Costa Rican Colon', + 'symbol' => '₡', + 'format' => '₡1,0.00', + 'exchange_rate' => 0.00, + ], + 'CUC' => [ + 'name' => 'Cuban Convertible Peso', + 'symbol' => 'CUC', + 'format' => 'CUC1,0.00', + 'exchange_rate' => 0.00, + ], + 'CUP' => [ + 'name' => 'Cuban Peso', + 'symbol' => '$MN', + 'format' => '$MN1,0.00', + 'exchange_rate' => 0.00, + ], + 'CVE' => [ + 'name' => 'Cape Verde Escudo', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'CZK' => [ + 'name' => 'Czech Koruna', + 'symbol' => 'Kč', + 'format' => '1 0,00 Kč', + 'exchange_rate' => 0.00, + ], + 'DJF' => [ + 'name' => 'Djibouti Franc', + 'symbol' => 'Fdj', + 'format' => '1,0.Fdj', + 'exchange_rate' => 0.00, + ], + 'DKK' => [ + 'name' => 'Danish Krone', + 'symbol' => 'kr.', + 'format' => '1 0,00 kr.', + 'exchange_rate' => 0.00, + ], + 'DOP' => [ + 'name' => 'Dominican Peso', + 'symbol' => 'RD$', + 'format' => 'RD$1,0.00', + 'exchange_rate' => 0.00, + ], + 'DZD' => [ + 'name' => 'Algerian Dinar', + 'symbol' => 'د.ج‏', + 'format' => 'د.ج‏ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'EGP' => [ + 'name' => 'Egyptian Pound', + 'symbol' => 'ج.م', + 'format' => 'ج.م 1,0.00', + 'exchange_rate' => 0.00, + ], + 'ERN' => [ + 'name' => 'Eritrea, Nakfa', + 'symbol' => 'Nfk', + 'format' => '1,0.00Nfk', + 'exchange_rate' => 0.00, + ], + 'ETB' => [ + 'name' => 'Ethiopian Birr', + 'symbol' => 'ETB', + 'format' => 'ETB1,0.00', + 'exchange_rate' => 0.00, + ], + 'EUR' => [ + 'name' => 'Euro', + 'symbol' => '€', + 'format' => '1.0,00 €', + 'exchange_rate' => 0.00, + ], + 'FJD' => [ + 'name' => 'Fiji Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'FKP' => [ + 'name' => 'Falkland Islands Pound', + 'symbol' => '£', + 'format' => '£1,0.00', + 'exchange_rate' => 0.00, + ], + 'GBP' => [ + 'name' => 'Pound Sterling', + 'symbol' => '£', + 'format' => '£1,0.00', + 'exchange_rate' => 0.00, + ], + 'GEL' => [ + 'name' => 'Georgia, Lari', + 'symbol' => 'Lari', + 'format' => '1 0,00 Lari', + 'exchange_rate' => 0.00, + ], + 'GHS' => [ + 'name' => 'Ghana Cedi', + 'symbol' => '₵', + 'format' => '₵1,0.00', + 'exchange_rate' => 0.00, + ], + 'GIP' => [ + 'name' => 'Gibraltar Pound', + 'symbol' => '£', + 'format' => '£1,0.00', + 'exchange_rate' => 0.00, + ], + 'GMD' => [ + 'name' => 'Gambia, Dalasi', + 'symbol' => 'D', + 'format' => '1,0.00D', + 'exchange_rate' => 0.00, + ], + 'GNF' => [ + 'name' => 'Guinean franc', + 'symbol' => 'FG', + 'format' => '1,0.00FG', + 'exchange_rate' => 0.00, + ], + 'GTQ' => [ + 'name' => 'Guatemala, Quetzal', + 'symbol' => 'Q', + 'format' => 'Q1,0.00', + 'exchange_rate' => 0.00, + ], + 'GYD' => [ + 'name' => 'Guyana Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'HKD' => [ + 'name' => 'Hong Kong Dollar', + 'symbol' => 'HK$', + 'format' => 'HK$1,0.00', + 'exchange_rate' => 0.00, + ], + 'HNL' => [ + 'name' => 'Honduras, Lempira', + 'symbol' => 'L.', + 'format' => 'L. 1,0.00', + 'exchange_rate' => 0.00, + ], + 'HRK' => [ + 'name' => 'Croatian Kuna', + 'symbol' => 'kn', + 'format' => '1,0.00 kn', + 'exchange_rate' => 0.00, + ], + 'HTG' => [ + 'name' => 'Haiti, Gourde', + 'symbol' => 'G', + 'format' => 'G1,0.00', + 'exchange_rate' => 0.00, + ], + 'HUF' => [ + 'name' => 'Hungary, Forint', + 'symbol' => 'Ft', + 'format' => '1 0,00 Ft', + 'exchange_rate' => 0.00, + ], + 'IDR' => [ + 'name' => 'Indonesia, Rupiah', + 'symbol' => 'Rp', + 'format' => 'Rp1,0.', + 'exchange_rate' => 0.00, + ], + 'ILS' => [ + 'name' => 'New Israeli Shekel', + 'symbol' => '₪', + 'format' => '₪ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'INR' => [ + 'name' => 'Indian Rupee', + 'symbol' => '₹', + 'format' => '1,0.00₹', + 'exchange_rate' => 0.00, + ], + 'IQD' => [ + 'name' => 'Iraqi Dinar', + 'symbol' => 'د.ع.‏', + 'format' => 'د.ع.‏ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'IRR' => [ + 'name' => 'Iranian Rial', + 'symbol' => '﷼', + 'format' => '﷼ 1,0/00', + 'exchange_rate' => 0.00, + ], + 'ISK' => [ + 'name' => 'Iceland Krona', + 'symbol' => 'kr.', + 'format' => '1,0. kr.', + 'exchange_rate' => 0.00, + ], + 'JMD' => [ + 'name' => 'Jamaican Dollar', + 'symbol' => 'J$', + 'format' => 'J$1,0.00', + 'exchange_rate' => 0.00, + ], + 'JOD' => [ + 'name' => 'Jordanian Dinar', + 'symbol' => 'د.ا.‏', + 'format' => 'د.ا.‏ 1,0.000', + 'exchange_rate' => 0.00, + ], + 'JPY' => [ + 'name' => 'Japan, Yen', + 'symbol' => '¥', + 'format' => '¥1,0.', + 'exchange_rate' => 0.00, + ], + 'KES' => [ + 'name' => 'Kenyan Shilling', + 'symbol' => 'S', + 'format' => 'S1,0.00', + 'exchange_rate' => 0.00, + ], + 'KGS' => [ + 'name' => 'Kyrgyzstan, Som', + 'symbol' => 'сом', + 'format' => '1 0-00 сом', + 'exchange_rate' => 0.00, + ], + 'KHR' => [ + 'name' => 'Cambodia, Riel', + 'symbol' => '៛', + 'format' => '1,0.៛', + 'exchange_rate' => 0.00, + ], + 'KMF' => [ + 'name' => 'Comoro Franc', + 'symbol' => 'CF', + 'format' => '1,0.00CF', + 'exchange_rate' => 0.00, + ], + 'KPW' => [ + 'name' => 'North Korean Won', + 'symbol' => '₩', + 'format' => '₩1,0.', + 'exchange_rate' => 0.00, + ], + 'KRW' => [ + 'name' => 'South Korea, Won', + 'symbol' => '₩', + 'format' => '₩1,0.', + 'exchange_rate' => 0.00, + ], + 'KWD' => [ + 'name' => 'Kuwaiti Dinar', + 'symbol' => 'دينار‎‎‏', + 'format' => 'دينار‎‎‏ 1,0.000', + 'exchange_rate' => 0.00, + ], + 'KYD' => [ + 'name' => 'Cayman Islands Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'KZT' => [ + 'name' => 'Kazakhstan, Tenge', + 'symbol' => '₸', + 'format' => '₸1 0-00', + 'exchange_rate' => 0.00, + ], + 'LAK' => [ + 'name' => 'Laos, Kip', + 'symbol' => '₭', + 'format' => '1,0.₭', + 'exchange_rate' => 0.00, + ], + 'LBP' => [ + 'name' => 'Lebanese Pound', + 'symbol' => 'ل.ل.‏', + 'format' => 'ل.ل.‏ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'LKR' => [ + 'name' => 'Sri Lanka Rupee', + 'symbol' => '₨', + 'format' => '₨ 1,0.', + 'exchange_rate' => 0.00, + ], + 'LRD' => [ + 'name' => 'Liberian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'LSL' => [ + 'name' => 'Lesotho, Loti', + 'symbol' => 'M', + 'format' => '1,0.00M', + 'exchange_rate' => 0.00, + ], + 'LYD' => [ + 'name' => 'Libyan Dinar', + 'symbol' => 'د.ل.‏', + 'format' => 'د.ل.‏1,0.000', + 'exchange_rate' => 0.00, + ], + 'MAD' => [ + 'name' => 'Moroccan Dirham', + 'symbol' => 'د.م.‏', + 'format' => 'د.م.‏ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'MDL' => [ + 'name' => 'Moldovan Leu', + 'symbol' => 'lei', + 'format' => '1,0.00 lei', + 'exchange_rate' => 0.00, + ], + 'MGA' => [ + 'name' => 'Malagasy Ariary', + 'symbol' => 'Ar', + 'format' => 'Ar1,0.', + 'exchange_rate' => 0.00, + ], + 'MKD' => [ + 'name' => 'Macedonia, Denar', + 'symbol' => 'ден.', + 'format' => '1,0.00 ден.', + 'exchange_rate' => 0.00, + ], + 'MMK' => [ + 'name' => 'Myanmar, Kyat', + 'symbol' => 'K', + 'format' => 'K1,0.00', + 'exchange_rate' => 0.00, + ], + 'MNT' => [ + 'name' => 'Mongolia, Tugrik', + 'symbol' => '₮', + 'format' => '₮1 0,00', + 'exchange_rate' => 0.00, + ], + 'MOP' => [ + 'name' => 'Macao, Pataca', + 'symbol' => 'MOP$', + 'format' => 'MOP$1,0.00', + 'exchange_rate' => 0.00, + ], + 'MRU' => [ + 'name' => 'Mauritania, Ouguiya', + 'symbol' => 'UM', + 'format' => '1,0.00UM', + 'exchange_rate' => 0.00, + ], + 'MTL' => [ + 'name' => 'Maltese Lira', + 'symbol' => '₤', + 'format' => '₤1,0.00', + 'exchange_rate' => 0.00, + ], + 'MUR' => [ + 'name' => 'Mauritius Rupee', + 'symbol' => '₨', + 'format' => '₨1,0.00', + 'exchange_rate' => 0.00, + ], + 'MVR' => [ + 'name' => 'Maldives, Rufiyaa', + 'symbol' => 'MVR', + 'format' => '1,0.0 MVR', + 'exchange_rate' => 0.00, + ], + 'MWK' => [ + 'name' => 'Malawi, Kwacha', + 'symbol' => 'MK', + 'format' => 'MK1,0.00', + 'exchange_rate' => 0.00, + ], + 'MXN' => [ + 'name' => 'Mexican Peso', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'MYR' => [ + 'name' => 'Malaysian Ringgit', + 'symbol' => 'RM', + 'format' => 'RM1,0.00', + 'exchange_rate' => 0.00, + ], + 'MZN' => [ + 'name' => 'Mozambique Metical', + 'symbol' => 'MT', + 'format' => 'MT1,0.', + 'exchange_rate' => 0.00, + ], + 'NAD' => [ + 'name' => 'Namibian Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'NGN' => [ + 'name' => 'Nigeria, Naira', + 'symbol' => '₦', + 'format' => '₦1,0.00', + 'exchange_rate' => 0.00, + ], + 'NIO' => [ + 'name' => 'Nicaragua, Cordoba Oro', + 'symbol' => 'C$', + 'format' => 'C$ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'NOK' => [ + 'name' => 'Norwegian Krone', + 'symbol' => 'kr', + 'format' => '1.0,00 kr', + 'exchange_rate' => 0.00, + ], + 'NPR' => [ + 'name' => 'Nepalese Rupee', + 'symbol' => '₨', + 'format' => '₨1,0.00', + 'exchange_rate' => 0.00, + ], + 'NZD' => [ + 'name' => 'New Zealand Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'OMR' => [ + 'name' => 'Rial Omani', + 'symbol' => '﷼', + 'format' => '﷼ 1,0.000', + 'exchange_rate' => 0.00, + ], + 'PAB' => [ + 'name' => 'Panama, Balboa', + 'symbol' => 'B/.', + 'format' => 'B/. 1,0.00', + 'exchange_rate' => 0.00, + ], + 'PEN' => [ + 'name' => 'Peru, Nuevo Sol', + 'symbol' => 'S/.', + 'format' => 'S/. 1,0.00', + 'exchange_rate' => 0.00, + ], + 'PGK' => [ + 'name' => 'Papua New Guinea, Kina', + 'symbol' => 'K', + 'format' => 'K1,0.00', + 'exchange_rate' => 0.00, + ], + 'PHP' => [ + 'name' => 'Philippine Peso', + 'symbol' => '₱', + 'format' => '₱1,0.00', + 'exchange_rate' => 0.00, + ], + 'PKR' => [ + 'name' => 'Pakistan Rupee', + 'symbol' => '₨', + 'format' => '₨1,0.00', + 'exchange_rate' => 0.00, + ], + 'PLN' => [ + 'name' => 'Poland, Zloty', + 'symbol' => 'zł', + 'format' => '1 0,00 zł', + 'exchange_rate' => 0.00, + ], + 'PYG' => [ + 'name' => 'Paraguay, Guarani', + 'symbol' => '₲', + 'format' => '₲ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'QAR' => [ + 'name' => 'Qatari Rial', + 'symbol' => '﷼', + 'format' => '﷼ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'RON' => [ + 'name' => 'Romania, New Leu', + 'symbol' => 'lei', + 'format' => '1,0.00 lei', + 'exchange_rate' => 0.00, + ], + 'RSD' => [ + 'name' => 'Serbian Dinar', + 'symbol' => 'Дин.', + 'format' => '1,0.00 Дин.', + 'exchange_rate' => 0.00, + ], + 'RUB' => [ + 'name' => 'Russian Ruble', + 'symbol' => '₽', + 'format' => '1 0,00 ₽', + 'exchange_rate' => 0.00, + ], + 'RWF' => [ + 'name' => 'Rwanda Franc', + 'symbol' => 'RWF', + 'format' => 'RWF 1 0,00', + 'exchange_rate' => 0.00, + ], + 'SAR' => [ + 'name' => 'Saudi Riyal', + 'symbol' => '﷼', + 'format' => '﷼ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'SBD' => [ + 'name' => 'Solomon Islands Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'SCR' => [ + 'name' => 'Seychelles Rupee', + 'symbol' => '₨', + 'format' => '₨1,0.00', + 'exchange_rate' => 0.00, + ], + 'SDG' => [ + 'name' => 'Sudanese Pound', + 'symbol' => 'ج.س', + 'format' => '1,0.00 Sd', + 'exchange_rate' => 0.00, + ], + 'SEK' => [ + 'name' => 'Swedish Krona', + 'symbol' => 'kr', + 'format' => '1 0,00 kr', + 'exchange_rate' => 0.00, + ], + 'SGD' => [ + 'name' => 'Singapore Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'SHP' => [ + 'name' => 'Saint Helena Pound', + 'symbol' => '£', + 'format' => '£1,0.00', + 'exchange_rate' => 0.00, + ], + 'SLL' => [ + 'name' => 'Sierra Leone, Leone', + 'symbol' => 'Le', + 'format' => 'Le1,0.00', + 'exchange_rate' => 0.00, + ], + 'SOS' => [ + 'name' => 'Somali Shilling', + 'symbol' => 'S', + 'format' => 'S1,0.00', + 'exchange_rate' => 0.00, + ], + 'SRD' => [ + 'name' => 'Surinam Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'SSP' => [ + 'name' => 'South Sudanese pound', + 'symbol' => 'SS£', + 'format' => 'SS £1,0.00', + 'exchange_rate' => 0.00, + ], + 'STN' => [ + 'name' => 'Sao Tome and Principe, Dobra', + 'symbol' => 'Db', + 'format' => 'Db1,0.00', + 'exchange_rate' => 0.00, + ], + 'SVC' => [ + 'name' => 'El Salvador Colon', + 'symbol' => '₡', + 'format' => '₡1,0.00', + 'exchange_rate' => 0.00, + ], + 'SYP' => [ + 'name' => 'Syrian Pound', + 'symbol' => '£', + 'format' => '£ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'SZL' => [ + 'name' => 'Swaziland, Lilangeni', + 'symbol' => 'E', + 'format' => 'E1,0.00', + 'exchange_rate' => 0.00, + ], + 'THB' => [ + 'name' => 'Thailand, Baht', + 'symbol' => '฿', + 'format' => '฿1,0.00', + 'exchange_rate' => 0.00, + ], + 'TJS' => [ + 'name' => 'Tajikistan, Somoni', + 'symbol' => 'TJS', + 'format' => '1 0;00 TJS', + 'exchange_rate' => 0.00, + ], + 'TMT' => [ + 'name' => 'Turkmenistani New Manat', + 'symbol' => 'm', + 'format' => '1 0,m', + 'exchange_rate' => 0.00, + ], + 'TND' => [ + 'name' => 'Tunisian Dinar', + 'symbol' => 'د.ت.‏', + 'format' => 'د.ت.‏ 1,0.000', + 'exchange_rate' => 0.00, + ], + 'TOP' => [ + 'name' => 'Tonga, Paanga', + 'symbol' => 'T$', + 'format' => 'T$1,0.00', + 'exchange_rate' => 0.00, + ], + 'TRY' => [ + 'name' => 'Turkish Lira', + 'symbol' => 'TL', + 'format' => '₺1,0.00', + 'exchange_rate' => 0.00, + ], + 'TTD' => [ + 'name' => 'Trinidad and Tobago Dollar', + 'symbol' => 'TT$', + 'format' => 'TT$1,0.00', + 'exchange_rate' => 0.00, + ], + 'TWD' => [ + 'name' => 'New Taiwan Dollar', + 'symbol' => 'NT$', + 'format' => 'NT$1,0.00', + 'exchange_rate' => 0.00, + ], + 'TZS' => [ + 'name' => 'Tanzanian Shilling', + 'symbol' => 'TSh', + 'format' => 'TSh1,0.00', + 'exchange_rate' => 0.00, + ], + 'UAH' => [ + 'name' => 'Ukraine, Hryvnia', + 'symbol' => '₴', + 'format' => '1 0,00₴', + 'exchange_rate' => 0.00, + ], + 'UGX' => [ + 'name' => 'Uganda Shilling', + 'symbol' => 'USh', + 'format' => 'USh1,0.00', + 'exchange_rate' => 0.00, + ], + 'USD' => [ + 'name' => 'US Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'UYU' => [ + 'name' => 'Peso Uruguayo', + 'symbol' => '$U', + 'format' => '$U 1,0.00', + 'exchange_rate' => 0.00, + ], + 'UZS' => [ + 'name' => 'Uzbekistan Sum', + 'symbol' => 'сўм', + 'format' => '1 0,00 сўм', + 'exchange_rate' => 0.00, + ], + 'VES' => [ + 'name' => 'Venezuela Bolivares soberano', + 'symbol' => 'Bs. S.', + 'format' => 'Bs. S. 1,0.00', + 'exchange_rate' => 0.00, + ], + 'VND' => [ + 'name' => 'Viet Nam, Dong', + 'symbol' => '₫', + 'format' => '1,0.0 ₫', + 'exchange_rate' => 0.00, + ], + 'VUV' => [ + 'name' => 'Vanuatu, Vatu', + 'symbol' => 'VT', + 'format' => '1,0.VT', + 'exchange_rate' => 0.00, + ], + 'WST' => [ + 'name' => 'Samoa, Tala', + 'symbol' => 'WS$', + 'format' => 'WS$1,0.00', + 'exchange_rate' => 0.00, + ], + 'XAF' => [ + 'name' => 'Franc CFA (XAF)', + 'symbol' => 'F.CFA', + 'format' => '1,0.00 F.CFA', + 'exchange_rate' => 0.00, + ], + 'XCD' => [ + 'name' => 'East Caribbean Dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + 'XOF' => [ + 'name' => 'Franc CFA (XOF)', + 'symbol' => 'F.CFA', + 'format' => '1,0.00 F.CFA', + 'exchange_rate' => 0.00, + ], + 'XPF' => [ + 'name' => 'CFP Franc', + 'symbol' => 'F', + 'format' => '1,0.00F', + 'exchange_rate' => 0.00, + ], + 'YER' => [ + 'name' => 'Yemeni Rial', + 'symbol' => '﷼', + 'format' => '﷼ 1,0.00', + 'exchange_rate' => 0.00, + ], + 'ZAR' => [ + 'name' => 'South Africa, Rand', + 'symbol' => 'R', + 'format' => 'R 1,0.00', + 'exchange_rate' => 0.00, + ], + 'ZMW' => [ + 'name' => 'Zambia Kwacha', + 'symbol' => 'ZK', + 'format' => 'ZK1,0.00', + 'exchange_rate' => 0.00, + ], + 'ZWL' => [ + 'name' => 'Zimbabwean dollar', + 'symbol' => '$', + 'format' => '$1,0.00', + 'exchange_rate' => 0.00, + ], + ]; + /** * Create a new command instance. */ @@ -81,7 +1034,8 @@ public function handle() if (count($this->currencies) == 0) { foreach ($r->json() as $rate) { - $model::create(Arr::only($rate, ['name', 'code', 'symbol', 'exchange_rate', 'fraction'])); + $rate['format'] = $this->rates[$rate['code']]['format']; + $model::create(Arr::only($rate, ['name', 'code', 'symbol', 'exchange_rate', 'fraction', 'format'])); } } else { diff --git a/src/Currency.php b/src/Currency.php index a590069..55b21c6 100644 --- a/src/Currency.php +++ b/src/Currency.php @@ -58,7 +58,7 @@ class Currency */ public function __construct(array $config, FactoryContract $cache) { - $this->config = $config; + $this->config = config('currency'); $this->cache = $cache->store($this->config('cache_driver')); } @@ -161,7 +161,6 @@ public function format($value, $code = null, $include_symbol = true) } // Format the value - $value = number_format($value, $decimals, $decimal, $thousand); switch ($this->config('driver')) { case 'model': @@ -177,8 +176,9 @@ public function format($value, $code = null, $include_symbol = true) break; } - $value = number_format($value, $currency->fraction ?? 2, $decimal, $thousand); + + $value = number_format((float) $value, (int) ($currency->fraction ?? 2), $decimal, $thousand); // Apply the formatted measurement if ($include_symbol) { $value = preg_replace($valRegex, $value, $format); @@ -244,7 +244,15 @@ public function getCurrency($code = null) { $code = $code ?: $this->getUserCurrency(); - return Arr::get($this->getCurrencies(), strtoupper($code)); + switch ($this->config('driver')) { + case 'model': + return $this->getCurrencies()->firstWhere('code', $code); + break; + + default: + return Arr::get($this->getCurrencies(), strtoupper($code)); + break; + } } /**