File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,26 @@ public static function getCountriesFromJson()
4040 return json_decode (File::get (__DIR__ . '/../resources/json/countries.json ' ), true );
4141 }
4242
43+ public static function getCurrenciesFromJson ()
44+ {
45+ return json_decode (File::get (__DIR__ . '/../resources/json/currencies.json ' ), true );
46+ }
47+
4348 public static function getCountryFromJson ($ country_code )
4449 {
4550 $ countries = json_decode (File::get (__DIR__ . '/../resources/json/countries.json ' ), true );
46- $ result = array_values (Arr::where ($ countries , function ($ value , $ key ) use ($ country_code ) {
51+ $ result = array_values (Arr::where ($ countries , function ($ value , $ key ) use ($ country_code ) {
4752 return $ value ['iso2 ' ] === $ country_code ;
4853 }));
49- return count ($ result ) ? (object ) $ result [0 ] : null ;
54+ return count ($ result ) ? (object ) $ result [0 ] : null ;
55+ }
56+
57+ public static function getCurrencyFromJson ($ currency_code )
58+ {
59+ $ currencies = json_decode (File::get (__DIR__ . '/../resources/json/currencies.json ' ), true );
60+ $ result = array_values (Arr::where ($ currencies , function ($ value , $ key ) use ($ currency_code ) {
61+ return $ value ['code ' ] === $ currency_code ;
62+ }));
63+ return count ($ result ) ? (object ) $ result [0 ] : null ;
5064 }
5165}
You can’t perform that action at this time.
0 commit comments