Skip to content

Commit

Permalink
Fix again
Browse files Browse the repository at this point in the history
  • Loading branch information
marcreichel committed Jan 16, 2019
1 parent 8d42f83 commit d0a2adb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Models/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,22 +270,22 @@ protected function getEndpoint()
*/
public function toArray(): array
{
$attributes = $this->attributes;
$attributes = collect($this->attributes);
$relations = collect($this->relations)->map(function($relation) {
return $relation->toArray();
});
return $attributes->merge($relations)->toArray();
return $attributes->merge($relations)->sortKeys()->toArray();
}

/**
* @return string
*/
public function toJson(): string
{
$attributes = $this->attributes;
$attributes = collect($this->attributes);
$relations = collect($this->relations)->map(function($relation) {
return $relation->toJson();
});
return $attributes->merge($relations)->toJson();
return $attributes->merge($relations)->sortKeys()->toJson();
}
}

0 comments on commit d0a2adb

Please sign in to comment.