Skip to content

Commit

Permalink
feat(api): add main_character_id to User (#35)
Browse files Browse the repository at this point in the history
Adding main character ID from grouping to the response object of the seat API
Altering user controller to add grouping pagination
  • Loading branch information
SebFerraro authored and warlof committed Aug 3, 2019
1 parent 4b653bc commit 71d86ce
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Http/Controllers/Api/v2/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function getUsers($user_id = null)
if (! is_null($user_id))
return new UserResource(User::findOrFail($user_id));

return UserResource::collection(User::paginate());
return UserResource::collection(User::with('group')->paginate());
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/Http/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function toArray($request)
'last_login_source' => $this->last_login_source,
'group_id' => $this->group->id,
'associated_character_ids' => $this->associatedCharacterIds(),
'main_character_id' => $this->group->main_character_id,
'token' => $this->refresh_token,
];
}
Expand Down

0 comments on commit 71d86ce

Please sign in to comment.