webpatser/laravel-countries

Undefined Index currency

Closed this issue · 1 comments

No idea what seems to be wrong ?
@foreach($countries as $country) <option value="{{ $country['country-code'] }}">{{ $country['name'] }}</option> @endforeach

this works fine but when i do the same thing with
`@foreach($countries as $country)

{{ $country['currency'] }} @endforeach`

this doesn't work and it prints out "Undefined Index: currency/currency_code"

Since a few countries have no currency (like Antarctica) this field is not always in the array.

Just do a isset($country['currency_code']) first.