-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
route:cache ignores application routing configuration #451
Comments
Thanks for the issue, but you'll need to update the reproduction steps with more details. Post your Post your code for booting Acorn — we can't see it |
Here's my <?php
use Illuminate\Support\Facades\Route;
Route::view('/welcome/', 'welcome')->name('welcome'); Here's my use Illuminate\Support\Facades\Route;
Route::get('/greeting', function () {
return 'Hello World';
}); Here's my MU plugin: <?php
use Roots\Acorn\Application;
add_action('after_setup_theme', function () {
Application::configure()
->withRouting(
web: base_path('routes/web.php'),
api: base_path('routes/api.php'),
)
->boot();
}, 0); The actual contents doesn't matter. If you look at the line of code I linked, the app instance is constructed using the default config. If you compare Acorn's implementation to the original you can see that they use the actual app bootstrapper to create a new instance:
|
Hey. I'm aware of this but haven't figured out a solution yet. Pulling the fresh application as you can see looking at Foundation is easier said then done in this environment since Acorn can be booted from anywhere vs. having a single source of truth at |
@Log1x Yeah, I can see how that complicates things. How about a filter to optionally provide the path to the equivalent of So something like Since it would all be opt-in I don't think that it would affect people that do not use the filter. |
I thought of that or checking for a constant. Another way might be setting the configuration state onto a property on the Application container before booting when calling |
Version
v5.0.1
What did you expect to happen?
I'd expect
route:cache
to cache all configured routes.What actually happens?
It only caches routes defined in
routes/web.php
.The root cause is that
GetsFreshApplication
creates its application instance using the default configuration:acorn/src/Roots/Acorn/Console/Concerns/GetsFreshApplication.php
Line 18 in 51a9fed
I discovered it because
routes/api.php
stopped working as soon as i cached routes.Steps to reproduce
routes/api.php
routes/api.php
route:clear
route:list
to see your API routeroute:cache
route:list
and find that your API route is missingroute:clear
route:list
to see your API route againSystem info
Ubuntu 24.04.2
Log output
Please confirm this isn't a support request.
No
The text was updated successfully, but these errors were encountered: