laravel路由打印排序的问题

laravel打印路由显示出来是乱的,我希望可以相同的控制器排序在一起,应该怎么做呢?
图片描述

阅读 2k
1 个回答
php artisan route:list --sort=action

使用--help 可以列出帮助信息,可以看到有个 --sort 参数,用于排序,默认是 uri
要使用控制器排序,设置参数为 action 即可。
如果需要降序,加上 -r 参数即可

php artisan route:list --help
> php artisan route:list --help
Usage:
  route:list [options]

Options:
      --method[=METHOD]  Filter the routes by method.
      --name[=NAME]      Filter the routes by name.
      --path[=PATH]      Filter the routes by path.
  -r, --reverse          Reverse the ordering of the routes.
      --sort[=SORT]      The column (host, method, uri, name, action, middleware) to sort by. [default: "uri"]
  -h, --help             Display this help message
  -q, --quiet            Do not output any message
  -V, --version          Display this application version
      --ansi             Force ANSI output
      --no-ansi          Disable ANSI output
  -n, --no-interaction   Do not ask any interactive question
      --env[=ENV]        The environment the command should run under
  -v|vv|vvv, --verbose   Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  List all registered routes
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题