Browse Source

Fix so that ordering within groups is preserved (to match ordering of Routes file) while groups are ordered Alphabetically (+1 squashed commit) (#126)

Squashed commits:
[b52e8e0] Fix so that grouping is sorted alphabetically

Changing the order of the sortby and groupby will allow the groups to be sorted in alphabetical order
f3cp 8 years ago
parent
commit
7747cd0387
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php

+ 3 - 1
src/Mpociot/ApiDoc/Commands/GenerateDocumentation.php

@@ -81,7 +81,9 @@ class GenerateDocumentation extends Command
         } else {
             $parsedRoutes = $this->processDingoRoutes($generator, $allowedRoutes, $routePrefix, $middleware);
         }
-        $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sortBy('resource');
+        $parsedRoutes = collect($parsedRoutes)->groupBy('resource')->sort(function ($a, $b) {
+            return strcmp($a->first()['resource'], $b->first()['resource']);
+        });
 
         $this->writeMarkdown($parsedRoutes);
     }