[13.x] Ensure bootstrap withMiddleware works for the DownCommand#58571
Merged
taylorotwell merged 7 commits intolaravel:masterfrom Feb 4, 2026
Merged
[13.x] Ensure bootstrap withMiddleware works for the DownCommand#58571taylorotwell merged 7 commits intolaravel:masterfrom
taylorotwell merged 7 commits intolaravel:masterfrom
Conversation
|
Thanks for submitting a PR! Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface. Pull requests that are abandoned in draft may be closed due to inactivity. |
Contributor
Author
|
Thanks! |
jackbayliss
added a commit
to jackbayliss/framework
that referenced
this pull request
Feb 13, 2026
…avel#58571) * Update ApplicationBuilder.php * Update DownCommand.php * Update MaintenanceModeTest.php * Update DownCommand.php * Simplify middleware instantiation in afterResolving * try both --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
taylorotwell
added a commit
that referenced
this pull request
Feb 13, 2026
) (#58798) * Update ApplicationBuilder.php * Update DownCommand.php * Update MaintenanceModeTest.php * Update DownCommand.php * Simplify middleware instantiation in afterResolving * try both --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
jackbayliss
added a commit
to jackbayliss/framework
that referenced
this pull request
Feb 16, 2026
…avel#58571) * Update ApplicationBuilder.php * Update DownCommand.php * Update MaintenanceModeTest.php * Update DownCommand.php * Simplify middleware instantiation in afterResolving * try both --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was reported via #58559
Currently, to get excluded paths in app/bootstrap working with
php artisan down, you need to create your ownApp\Http\Middleware\PreventRequestsDuringMaintenancemiddleware class.This PR fixes it so the
preventRequestsDuringMaintenance()configuration inbootstrap/app.phpactually works with the down command. Which is recommended in statamic hereBefore this fix, configuring it like this does nothing (with the file driver):
I've also removed the
App\Http\Middleware\PreventRequestsDuringMaintenanceusage for the framework middleware, as afaik the middleware stuff went in Laravel 11 - not sure if you want to keep it, but can re-work this to check it exists first then fallback.I've added the ConsoleKernel bit so console commands can access the middleware static proerties ie so DownCommand can access the excluded paths - but granted you may have a better way of doing it. But I believe it's safe as middleware classes only execute during HTTP requests? (I think) and this just makes sure the static stuff is available.
Targeted 13.x as is a B/C, and needs a good think.
I've included a test that fails without the changes. But couldn't figure out how to get a test to fully cover the need for the ConsoleKernel bit - however tested locally.
Any feedback welcome, maybe we just shouldn't cover this usage, dunno.
Cheers