From 36881dd3fbda345d06d97e084f248d027a2fc3e1 Mon Sep 17 00:00:00 2001 From: Daniel Coulbourne Date: Mon, 13 May 2024 13:15:09 -0400 Subject: [PATCH] Update Middleware docs --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 25437ca..34c6270 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,23 @@ Add the `Wafris\AllowRequestMiddleware` middleware to routes that you want to ha ### Protecting all routes +To protect all routes in your Laravel application, add the `Wafris\AllowRequestMiddleware` globally. + +#### Laravel 11 + +[Starting in Laravel 11](https://laravel.com/docs/11.x/middleware#global-middleware), middleware are registered in `bootstrap/app.php`. Add the following line in the `withMiddleware` section of that file: + +```php +Application::configure(basePath: dirname(__DIR__)) + // ... + ->withMiddleware(function (Middleware $middleware) { + // ... other middleware + $middleware->append(\Wafris\AllowRequestMiddleware::class); + }); +``` + +### Laravel 10 + To protect all routes in your Laravel application, add `Wafris\AllowRequestMiddleware` to the `$middleware` property of your `app/Http/Kernel.php` class. ```php