Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with RouteServiceProvider - respect the order of initialization #118

Open
josefryzi opened this issue Nov 8, 2021 · 0 comments

Comments

@josefryzi
Copy link

josefryzi commented Nov 8, 2021

Hi,
is it possible to respect order of initialization in app/providers.php?

My app providers order:

  • App\Providers\AnnotationsServiceProvider::class,
  • App\Providers\RouteServiceProvider::class,

The intro:

  • I am using RouteServiceProvider with some routes in web.php
  • I am using fallback route Route::get('/{any}', ...) to catch all undefined routes - lets call this route "fallback_route"
  • I created route via annotation + route is cached (with artisan route:scan) - lets call this route "route_a"

The problem:

  • when I want to visit "route_a" I am getting "fallback_route"
  • when I disable "fallback_route" then "route_a" is working
  • seems like anotation routes are inserted after RouterServiceProvider even I initialized AnnotationsServiceProvider before RouterServiceProvider

Solution:
A) Respect order of providers in app/provider.php
B) Somehow trigger annotations boot method before RouterServiceProvider class
C) please suggest solution

Could you pleaase help me?
Thank you

@josefryzi josefryzi changed the title Comaptibility with RouteServiceProvider - respect the order of initialization Compatibility with RouteServiceProvider - respect the order of initialization Nov 8, 2021
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

No branches or pull requests

1 participant