Skip to content

[9.x] Fix route:list --except-vendor hiding Route::view() & Route::redirect()#41465

Merged
taylorotwell merged 1 commit into
laravel:9.xfrom
derekmd:route-list-illuminate-magic-routes
Mar 14, 2022
Merged

[9.x] Fix route:list --except-vendor hiding Route::view() & Route::redirect()#41465
taylorotwell merged 1 commit into
laravel:9.xfrom
derekmd:route-list-illuminate-magic-routes

Conversation

@derekmd

@derekmd derekmd commented Mar 13, 2022

Copy link
Copy Markdown
Contributor

Fixes #41416

php artisan route:list --except-vendor

This doesn't show paths registered via Route::view() or Route::redirect().

Don't consider Illuminate\Routing\RedirectController & Illuminate\Routing\ViewController as vendor-registered routes. Assume Route::view() or Route::redirect() were called in userland routes/*.php.


To more accurately track this, Illuminate\Routing\Route needs a new class property $isVendor. The constructor would traverse its stacktrace to find the originating call. It could be an app()->environment('development', 'testing')-only
code path but I don't think the Route class bloat is worth it considering these "magic route" methods are more a userland feature than packageland. It could also introduce a breaking change to serializing routes.

@derekmd derekmd force-pushed the route-list-illuminate-magic-routes branch from 9370c7f to 57bd20b Compare March 13, 2022 21:30
@derekmd derekmd marked this pull request as draft March 13, 2022 21:38
Don't consider Illuminate\Routing\RedirectController & ViewController
as vendor-registered routes. Assume Route::view() or Route::redirect()
were called in userland routes/*.php.
@derekmd derekmd force-pushed the route-list-illuminate-magic-routes branch from 57bd20b to 593697d Compare March 13, 2022 21:50
@derekmd derekmd marked this pull request as ready for review March 13, 2022 21:53
@taylorotwell taylorotwell merged commit bd422ae into laravel:9.x Mar 14, 2022
@derekmd derekmd deleted the route-list-illuminate-magic-routes branch March 14, 2022 19:48
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.

Route:view() are not listed when using --except-vendor

2 participants