Skip to content

Commit

Permalink
Merge pull request #11 from Wafris/laravel-11
Browse files Browse the repository at this point in the history
Support Laravel 11
  • Loading branch information
DanielCoulbourne authored May 23, 2024
2 parents 4a43b9b + 36881dd commit 7a199fc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [8.2, 8.1]
laravel: [10.*]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

exclude:
- php: 8.1
laravel: 11.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
Expand All @@ -44,7 +42,7 @@ jobs:
- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: List Installed Dependencies
Expand Down
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
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
}
],
"require": {
"php": "^8.1",
"illuminate/contracts": "^10.0",
"php": ">=8.1",
"illuminate/contracts": "^10.0|^11.0",
"predis/predis": "^2.2",
"spatie/laravel-package-tools": "^1.14.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"orchestra/testbench": "^8.8",
"orchestra/testbench": "^8.8|^9.0",
"spatie/laravel-ray": "^1.26"
},
"autoload": {
Expand Down

0 comments on commit 7a199fc

Please sign in to comment.