From fdb8307052f36d41f8e0e36cd65774b5dedb453a Mon Sep 17 00:00:00 2001 From: TwilightDuck Date: Tue, 21 May 2024 11:18:11 +0200 Subject: [PATCH] Update webhook.md Since Laravel 11 the middlware is no longer included in the structure by default. --- docs/webhook.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/docs/webhook.md b/docs/webhook.md index f23546b..260e3a2 100644 --- a/docs/webhook.md +++ b/docs/webhook.md @@ -45,17 +45,16 @@ class MollieWebhookController extends Controller { Finally, it is _strongly advised_ to disable the `VerifyCsrfToken` middleware, which is included in the `web` middleware group by default. (Out of the box, Laravel applies the `web` middleware group to all routes in `routes/web.php`.) -You can exclude URIs from the CSRF protection in the `app/Http/Middleware/VerifyCsrfToken.php` file: +You can exclude the route from the CSRF protection in your `bootstrap/app.php`: ```php -/** - * The URIs that should be excluded from CSRF verification. - * - * @var array - */ -protected $except = [ - 'webhooks/mollie' -]; +// bootstrap/app.php + +->withMiddleware(function (Middleware $middleware) { + $middleware->validateCsrfTokens( + except: ['webhooks/mollie'] + ); +}) ``` If this solution does not work, open an [issue](https://github.com/mollie/laravel-mollie/issues) so we can assist you.