Skip to content

Commit 374f4f1

Browse files
Merge pull request #148 from rakutentech/feature/group-fix
Sort docs by `group`, `group_index`
2 parents e2f8080 + 0ba821a commit 374f4f1

File tree

2 files changed

+220
-152
lines changed

2 files changed

+220
-152
lines changed

src/LaravelRequestDocs.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,23 @@ public function filterByMethods($docs, $get, $post, $put, $path, $delete, $head)
119119

120120
public function groupDocs($docs, $group = 'default')
121121
{
122+
if ($group === 'default') {
123+
return $docs;
124+
}
125+
126+
$groupDocs = [];
127+
122128
if ($group === 'api_uri') {
123-
return $this->groupDocsByAPIURI($docs);
129+
$groupDocs = $this->groupDocsByAPIURI($docs);
124130
}
125131

126132
if ($group === 'controller_full_path') {
127-
return $this->groupDocsByFQController($docs);
133+
$groupDocs = $this->groupDocsByFQController($docs);
128134
}
129135

130-
return $docs;
136+
return collect($groupDocs)->sortBy(['group', 'group_index'])
137+
->values()
138+
->toArray();
131139
}
132140

133141
public function getControllersInfo(): array

0 commit comments

Comments
 (0)