io238 / laravel-iso-countries

Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.
MIT License
38 stars 9 forks source link

Numeric ISO Codes #4

Open crypnull opened 1 year ago

crypnull commented 1 year ago

I noticed the countries table does not include the numeric codes, I prefer storing countries by their numeric codes because they don't change like the 2 or 3 letter ones can, they very rarely change, but still do sometimes.

io238 commented 1 year ago

The Country model has a numeric attribute.

It is not used as primary key, but you can still query countries by their numeric code like this:

\Io238\ISOCountries\Models\Country::whereNumeric(716)->first()

For languages (ISO 639-1) there is no numeric code.

Do you also need the numeric code for currencies? I might be able to add this in a future release.