Skip to content

[7.x] Check route:list --columns option case insensitively#32521

Merged
taylorotwell merged 1 commit into
laravel:7.xfrom
matt-allan:route-list-columns-case-sensitivity
Apr 24, 2020
Merged

[7.x] Check route:list --columns option case insensitively#32521
taylorotwell merged 1 commit into
laravel:7.xfrom
matt-allan:route-list-columns-case-sensitivity

Conversation

@matt-allan
Copy link
Copy Markdown
Contributor

The route:list command has a --columns option you can use to specify what columns should be used. Weirdly if you use the same case for the column names the output uses nothing at all gets printed:

 $ php artisan route:list --columns 'Method,Uri'

It only works if you use all lowercase:

$ php artisan route:list --columns 'method,uri'
+----------+------------------------+
| Method   | URI                    |
+----------+------------------------+
| GET|HEAD | /                      |
| GET|HEAD | api/user               |
| GET|HEAD | home                   |
| GET|HEAD | login                  |
| POST     | login                  |
| POST     | logout                 |
| GET|HEAD | password/confirm       |
| POST     | password/confirm       |
| POST     | password/email         |
| GET|HEAD | password/reset         |
| POST     | password/reset         |
| GET|HEAD | password/reset/{token} |
| GET|HEAD | register               |
| POST     | register               |

This PR changes the comparison to be case-insensitive so you can use the same case as the output, lowercase, all uppercase, etc and it still works:

 $ php artisan route:list --columns 'Method,URI,name'  
+----------+------------------------+------------------+
| Method   | URI                    | Name             |
+----------+------------------------+------------------+
| GET|HEAD | /                      |                  |
| GET|HEAD | api/user               |                  |
| GET|HEAD | home                   | home             |
| GET|HEAD | login                  | login            |
| POST     | login                  |                  |
| POST     | logout                 | logout           |
| GET|HEAD | password/confirm       | password.confirm |
| POST     | password/confirm       |                  |
| POST     | password/email         | password.email   |
| GET|HEAD | password/reset         | password.request |
| POST     | password/reset         | password.update  |
| GET|HEAD | password/reset/{token} | password.reset   |
| GET|HEAD | register               | register         |
| POST     | register               |                  |
+----------+------------------------+------------------+

@taylorotwell taylorotwell merged commit 0cb79e1 into laravel:7.x Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants