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

Sorting the countries collection by common name - United Kingdom is misplaced #139

Open
Lindorie opened this issue Jan 14, 2020 · 0 comments

Comments

@Lindorie
Copy link

Lindorie commented Jan 14, 2020

Hi there,

I am trying to get a list of all countries to put in a select dropdown, so I need to sort it by common name.

$countries = Countries::where('postal', '!=', '')->sortBy('name.common')->pluck('name.common', 'postal');

By doing that, it is indeed sorting the list by common name, except that some countries are not sorted properly, e.g. United Kingdom, which should be placed between United Arab Emirates and United States, and instead I find it before Uganda:

firefox_2020-01-14_13-09-30

There are quite a lot of other countries that are not sorted properly, see this screenshot:

firefox_2020-01-14_14-55-44

Is my code wrong or is it a known issue?

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