Skip to content

Always return array to ui from allTeams() #966

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

Merged
merged 1 commit into from
Jan 25, 2022
Merged

Always return array to ui from allTeams() #966

merged 1 commit into from
Jan 25, 2022

Conversation

scrummitch
Copy link
Contributor

@scrummitch scrummitch commented Jan 25, 2022

Hi there, this is my first laravel PR

The $user->allTeams() method returns a merged collection in the HasTeams trait with $this->ownedTeams and $this->teams.

Unfortunately eloquent sortBy method will re-index the keys out of order, so json encoding the output value of this method will convert it to a map in javascript rather than an array.

The `$request->user()->allTeams()` method returns a merged collection in the HasTeams trait with `$this->ownedTeams` and `$this->teams`.

Unfortunately eloquent `sortBy` method will re-index the keys out of order, so json encoding the output value of this method will convert it to a map in javascript rather than an array.
@taylorotwell taylorotwell merged commit 3fa1ce6 into laravel:2.x Jan 25, 2022
@driesvints
Copy link
Member

Thanks @scrummitch!

@scrummitch scrummitch deleted the patch-1 branch January 25, 2022 23:33
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.

3 participants