Skip to content

Commit a2dc7ef

Browse files
authored
Sorting possible models and events (#48249)
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.
1 parent 47767f6 commit a2dc7ef

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Illuminate/Console/GeneratorCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ protected function possibleModels()
247247

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

267268
return collect((new Finder)->files()->depth(0)->in($eventPath))
268269
->map(fn ($file) => $file->getBasename('.php'))
270+
->sort()
269271
->values()
270272
->all();
271273
}

0 commit comments

Comments
 (0)