Skip to content

Registering PreventRequestsDuringMaintenance Middleware Laravel 11 #10605

Answered by NeoIsRecursive
twd3 asked this question in Q&A
Discussion options

You must be logged in to vote

In bootstrap/app.php you should be able to do something like this in laravel 11 with the new skeleton:

->withMiddleware(function (Middleware $middleware) {
    $middleware->preventRequestsDuringMaintenance(except: [
        '/cp*'
    ]);
});

If you have the old skeleton I think you just have to change the usage of the existing PreventRequestsDuringMaintanance with your own. In one of my projects I have done it like this in the Http/Kernel file:

    protected $middleware = [
        ...
        \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
        ...
    ];

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@NeoIsRecursive
Comment options

Answer selected by twd3
@edalzell
Comment options

@duncanmcclean
Comment options

Comment options

You must be logged in to vote
2 replies
@NeoIsRecursive
Comment options

@twd3
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
4 participants