Laravel Adding Cookie Consent

[Solved] Laravel Adding Cookie Consent | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : Laravel Adding Cookie Consent

Answered by : hassan-joseph

1 - Add this package
https://github.com/spatie/laravel-cookie-consent
2 - publish the package to get the custom configuration
php artisan vendor:publish
3 - Add this in the home page in the top
@include('cookieConsent::index')
4 - Add the below style in the file “resources/views/vendor/cookieConsent/dialogContents.blade.php”
<div class="js-cookie-consent cookie-consent"> <div class="alert alert-warning alert-dismissible fade show text-center" role="alert" style="margin-bottom: 0rem !important;"> <span class="cookie-consent__message"> {!! trans('cookieConsent::texts.message') !!} </span> <button class="js-cookie-consent-agree cookie-consent__agree btn btn-sm btn-primary"> {{ trans('cookieConsent::texts.agree') }} </button> <button type="button" class="close" data-dismiss="alert" aria-label="Close"> <span aria-hidden="true">&times;</span> </button> </div>
</div> Sources
- https://github.com/spatie/laravel-cookie-consent
- https://stackoverflow.com/questions/60719259/unable-to-locate-publishable-resources

Source : https://github.com/spatie/laravel-cookie-consent | Last Update : Tue, 15 Mar 22

Answers related to laravel adding cookie consent

Code Explorer Popular Question For Php Frameworks Yii