Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel V.11 projects Middleware #72

Open
Mokei-it opened this issue Jul 20, 2024 · 1 comment
Open

Laravel V.11 projects Middleware #72

Mokei-it opened this issue Jul 20, 2024 · 1 comment

Comments

@Mokei-it
Copy link

Hello Caroline,
to complete your very usefull package at this point: https://github.com/statikbe/laravel-cookie-consent#usage for Laravel V.11 projects please evaluate adding the following:

// bootstrap\app.php

return Application::configure(basePath: dirname(DIR))
->withRouting(
...
)
->withMiddleware(function (Middleware $middleware) {
$middleware->alias([
...
])->web(append: [
\Statikbe\CookieConsent\CookieConsentMiddleware::class,
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})->create();

Thank you very much for your work.

@hamrak
Copy link

hamrak commented Jul 25, 2024

return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: dirname(__DIR__).'/routes/web.php',
        commands: dirname(__DIR__).'/routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        /**
         * For all sites
         */
        $middleware->use([
            \Statikbe\CookieConsent\CookieConsentMiddleware::class,
        ]);
        /**
         * If you want to call it in routes Route::group(['middleware' => ['cookie-consent']], function () { ... });
         */
        $middleware->group('cookie-consent', [
            \Statikbe\CookieConsent\CookieConsentMiddleware::class,
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants