File: D:/HostingSpaces/netwerkbrabant/netwerkbrabant.nl/app/Providers/CookieConsentServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Contracts\View\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\Cookie\Middleware\EncryptCookies;
class CookieConsentServiceProvider extends ServiceProvider
{
public function boot()
{
// Disable cookie encrypting
$this->app->resolving(EncryptCookies::class, function (EncryptCookies $encryptCookies) {
$encryptCookies->disableFor(config('cookie-consent.cookie_name'));
});
// Load config into view
$this->app['view']->composer('site.partials.cookieIndex', function (View $view) {
$cookieConsentConfig = config('cookie-consent');
$alreadyConsentedWithCookies = Cookie::has($cookieConsentConfig['cookie_name']);
$view->with(compact('alreadyConsentedWithCookies', 'cookieConsentConfig'));
});
}
public function register()
{
}
}