Skip to content

Commit 11251f2

Browse files
authored
Add filtering of the route list by domain (#40970)
1 parent cd1bbe9 commit 11251f2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Illuminate/Foundation/Console/RouteListCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ protected function getMiddleware($route)
212212
*/
213213
protected function filterRoute(array $route)
214214
{
215-
if (($this->option('name') && ! str_contains($route['name'], $this->option('name'))) ||
216-
$this->option('path') && ! str_contains($route['uri'], $this->option('path')) ||
217-
$this->option('method') && ! str_contains($route['method'], strtoupper($this->option('method')))) {
215+
if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) ||
216+
($this->option('path') && ! Str::contains($route['uri'], $this->option('path'))) ||
217+
($this->option('method') && ! Str::contains($route['method'], strtoupper($this->option('method')))) ||
218+
($this->option('domain') && ! Str::contains($route['domain'], $this->option('domain')))) {
218219
return;
219220
}
220221

@@ -418,6 +419,7 @@ protected function getOptions()
418419
['json', null, InputOption::VALUE_NONE, 'Output the route list as JSON'],
419420
['method', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by method'],
420421
['name', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by name'],
422+
['domain', null, InputOption::VALUE_OPTIONAL, 'Filter the routes by domain'],
421423
['path', null, InputOption::VALUE_OPTIONAL, 'Only show routes matching the given path pattern'],
422424
['except-path', null, InputOption::VALUE_OPTIONAL, 'Do not display the routes matching the given path pattern'],
423425
['reverse', 'r', InputOption::VALUE_NONE, 'Reverse the ordering of the routes'],

0 commit comments

Comments
 (0)