Skip to content

Commit

Permalink
Update Middleware docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielCoulbourne committed May 13, 2024
1 parent fbfed77 commit 36881dd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 36881dd

Please sign in to comment.