Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAKE IT DYNAMIC #199

Open
MotionPhix opened this issue May 24, 2023 · 0 comments
Open

MAKE IT DYNAMIC #199

MotionPhix opened this issue May 24, 2023 · 0 comments

Comments

@MotionPhix
Copy link

While the package does the job, I find it a bit awkward when calling, for example, $countries->where('name.common', 'Brazil')->first()->hydrate('currencies')->currencies->BRL->units->major->symbol;, you have to know beforehand what currency the country uses, in this case, BRL. The goal is to get the BRL dynamically when you supply the common name, in this case, Brazil. I am thinking, it should have been dynamic, instead of pinning the response to a currency symbol. Something like:

PragmaRX\Countries\Package\Support\Collection {
  #items: array:1 [▼
        "banknotes" => array:2 [▶]
        "coins" => array:2 [▶]
        "data_sources" => array:1 [▶]
        "iso" => array:2 [▶]
        "name" => "Brazilian real"
        "record_type" => "currency"
        "units" => array:2 [▶]
  ]
  #cache: []
}

Instead of what we now have, which is...

PragmaRX\Countries\Package\Support\Collection {
  #items: array:1 [▼
    "BRL" => PragmaRX\Countries\Package\Support\Collection {#1565 ▼
      #items: array:7 [▼
        "banknotes" => array:2 [▶]
        "coins" => array:2 [▶]
        "data_sources" => array:1 [▶]
        "iso" => array:2 [▶]
        "name" => "Brazilian real"
        "record_type" => "currency"
        "units" => array:2 [▶]
      ]
      #cache: []
    }
  ]
  #cache: []
}

This makes it hard to use it dynamically when you just want to pull the symbol in an app where multiple currencies will be used, and you can't tell what currencies the user will add as there are provisions in the app to add currencies. If you could work on that to make it dynamic it would be greatly appreciated, users will still be able to get the currency symbol from the iso like in the same response like:

"iso" => array:2 [▼
  "code" => "BRL"
  "number" => "986"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant