Skip to content

Commit

Permalink
Sorting possible models and events
Browse files Browse the repository at this point in the history
With Laravel Prompts and the new dropdown combobox, you have the opportunity to open the dropdown and see a list of all possible models and events for the various commands. Currently the models and events are not sorted in any logical order that is readily visible. 

This PR sorts the models and events by name to ensure the dropdown looks nicer.
  • Loading branch information
TWithers committed Aug 30, 2023
1 parent 47767f6 commit 5df9055
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ protected function possibleModels()

return collect((new Finder)->files()->depth(0)->in($modelPath))
->map(fn ($file) => $file->getBasename('.php'))
->sort()
->values()
->all();
}
Expand All @@ -266,6 +267,7 @@ protected function possibleEvents()

return collect((new Finder)->files()->depth(0)->in($eventPath))
->map(fn ($file) => $file->getBasename('.php'))
->sort()
->values()
->all();
}
Expand Down

0 comments on commit 5df9055

Please sign in to comment.