0

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

kangfq 39
2019-06-12 提问
1 个回答
0

已采纳
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

撰写答案

推广链接