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

[8.x] Add a method to sort keys in a collection using a callback #40458

Merged
merged 3 commits into from
Jan 17, 2022
Merged

[8.x] Add a method to sort keys in a collection using a callback #40458

merged 3 commits into from
Jan 17, 2022

Conversation

redelschaap
Copy link
Contributor

New attempt for this feature, since I really think this offers more flexibility for sorting collection items by key that would otherwise need an unnecessary amount of code. See also PR #40341.


Other than sorting collection item keys case insensitive, use cases would be:

  • Sorting items where keys represent written dates (using a userland function)
  • Sorting items where keys represent software versions (using collect([...])->sortKeysUsing('version_compare');)

@nunomaduro nunomaduro changed the title Add a method to sort keys in a collection using a callback [8.x] Add a method to sort keys in a collection using a callback Jan 17, 2022
@taylorotwell taylorotwell merged commit f9870ef into laravel:8.x Jan 17, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants