tjgazel / laravel-accept-cookies
Pop-up cookie acceptance terms for Laravel 5.5+
Installs: 119
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:package
Requires
- laravel/framework: >=5.5
Requires (Dev)
- illuminate/contracts: ^5.5
- illuminate/http: ^5.5
- illuminate/routing: ^5.5
- illuminate/session: ^5.5.0
- illuminate/support: ^5.5
This package is auto-updated.
Last update: 2025-02-05 21:38:21 UTC
README
- Dependencies
- Boostrap 4
- JQuery 3
- installation and configuration
- Tanks
See examples in:
https://alfaunipac.com.br
https://unipacto.com.br
https://faculdadealfa.com.br
installation and configuration
1) Run composer require tjgazel/laravel-accept-cookies
to include this in your project. Will automatically
discover the provider and the alias.
2) Run php artisan vendor:publish --provider="TJGazel\Laravel\AcceptCookies\AcceptCookiesProvider" --tag="accept-cookies:config"
to publish the config file in config/accept-cookies.php
.
<?php return [ 'sessionName' => 'accept-cookies', 'route' => [ 'middleware' => [], 'prefix' => 'accept-cookies', 'name' => 'accept-cookies.', 'route' => [ 'name' => 'accept', 'url' => '/accept' ] ], 'background-color' => 'bg-dark', 'text' => 'We use cookies and similar technologies to offer you a better experience on our platform, improve performance, analyze your interactions on our site and personalize content. To learn more, see our Privacy Policy.', 'linkMoreInfoUrl' => 'https://my-site.com/storage/more-info.pdf', 'linkMoreInfoTarget' => '_blank', 'linkMoreInfoText' => 'More info.', 'linkMoreInfoCollor' => 'text-primary', 'btnAcceptText' => 'Accept', 'btnAcceptColor' => 'text-success', 'btnRefuseText' => 'Refuse', 'btnRefuseColor' => 'text-danger', ];
3) Include AcceptCookies::routes()
in routes/web.php
.
<?php AcceptCookies::routes(); Route::get('/', function() { // });
4) 1 - Include <meta name="csrf-token" content="{{ csrf_token() }}">
.
2 - Include @stack('js')
after jquery and boostrap scripts.
3 - Include@include('accept-cookies::template')
somewhere in your template.
<!DOCTYPE html> <html lang="{{ app()->getLocale() }}"> <head> <!-- CSRF Token --> <meta name="csrf-token" content="{{ csrf_token() }}"> <link rel="stylesheet" type="text/css" href="/css/app.css"> </head> <body> <div id="app"> <header></header> <main> @yield('content') </main> <footer></footer> @include('accept-cookies::template') </app> <script type="text/javascript" src="js/app.js"></script> @stack('js') </body> </html>
5) Optional:
Run php artisan vendor:publish --provider="TJGazel\Laravel\AcceptCookies\AcceptCookiesProvider" --tag="accept-cookies:views"
to publish the template view. Modify the published template located
at resources/views/vendor/accept-cookies/template.php
to your liking.
Tanks for:
Author: Talles Gazel
Linkedin