You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// IMPORTANT: add the following line AFTER "App\Providers\RouteServiceProvider::class,"
69
+
App\Providers\CookiesServiceProvider::class,
70
+
])->toArray(),
71
+
```
72
+
3. Publish the configuration file: `php artisan vendor:publish --tag=laravel-cookie-consent-config`
73
+
74
+
If you want to customize the consent modal's views:
75
+
76
+
1. Publish the customizable views: `php artisan vendor:publish --tag=laravel-cookie-consent-views`
77
+
2. Publish the translation files: `php artisan vendor:publish --tag=laravel-cookie-consent-lang`
65
78
66
79
More on [customization](#customization) below.
67
80
68
-
Now, we'll have to register and configure the used cookies. A good place to do so is in the `App\Providers\AppServiceProvider`'s `boot`method, but feel free to create your own `CookiesServiceProvider`.
81
+
Now, we'll have to register and configure the used cookiesin the freshly published `App\Providers\CookiesServiceProvider::registerCookies()` method:
69
82
70
83
```php
84
+
namespace App\Providers;
85
+
71
86
use Whitecube\LaravelCookieConsent\Consent;
72
87
use Whitecube\LaravelCookieConsent\Facades\Cookies;
88
+
use Whitecube\LaravelCookieConsent\CookiesServiceProvider as ServiceProvider;
73
89
74
-
public function boot()
90
+
class CookiesServiceProvider extends ServiceProvider
75
91
{
76
-
// Register Laravel's base cookies under the "required" cookies section:
77
-
Cookies::essentials()
78
-
->session()
79
-
->csrf();
80
-
81
-
// Register all Analytics cookies at once using one single shorthand method:
82
-
Cookies::analytics()
83
-
->google(env('GOOGLE_ANALYTICS_ID'));
84
-
85
-
// Register custom cookies under the pre-existing "optional" category:
86
-
Cookies::optional()
87
-
->name('darkmode_enabled')
88
-
->description('This cookie helps us remember your preferences regarding the interface\'s brightness.')
0 commit comments