Skip to content

MAKE IT DYNAMIC #199

Description

@MotionPhix

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"
]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions