Skip to content

Always return array to ui from allTeams()#966

Merged
taylorotwell merged 1 commit intolaravel:2.xfrom
scrummitch:patch-1
Jan 25, 2022
Merged

Always return array to ui from allTeams()#966
taylorotwell merged 1 commit intolaravel:2.xfrom
scrummitch:patch-1

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