### Install package with Composer Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Install the package via Composer. ```bash composer require jeffersongoncalves/laravel-cookie-consent ``` -------------------------------- ### Run migrations Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Run the migrations to create the settings in the database. ```bash php artisan migrate ``` -------------------------------- ### Run tests Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Run the package tests. ```bash composer test ``` -------------------------------- ### Publish settings migrations Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Publish the settings migrations (optional). ```bash php artisan vendor:publish --tag=cookie-consent-settings-migrations ``` -------------------------------- ### Publish views Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Publish the package views (optional). ```bash php artisan vendor:publish --tag=cookie-consent-views ``` -------------------------------- ### Run static analysis and code formatting Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Bash commands to run PHPStan static analysis and Pint code formatting. ```bash # Static analysis vendor/bin/phpstan analyse # Code formatting vendor/bin/pint ``` -------------------------------- ### Include head template Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Add the head template to your layout. ```php @include('cookie-consent::cookie-consent-head') ``` -------------------------------- ### Add new settings property Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Steps to add a new property to CookieConsentSettings, create a migration, and run migrations. ```php public string $new_property; ``` ```php $this->migrator->add('cookie_consent.new_property', 'default_value'); ``` ```bash php artisan migrate ``` -------------------------------- ### Test settings access with helper and group Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Pest tests verifying that the cookie_consent_settings() helper returns an instance of CookieConsentSettings and that the settings group is 'cookie_consent'. ```php use JeffersonGoncalves\CookieConsent\Settings\CookieConsentSettings; it('returns settings instance via helper', function () { $settings = cookie_consent_settings(); expect($settings)->toBeInstanceOf(CookieConsentSettings::class); }); it('has correct settings group', function () { expect(CookieConsentSettings::group())->toBe('cookie_consent'); }); ``` -------------------------------- ### Include body template Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Add the body template to your layout. ```php @include('cookie-consent::cookie-consent-body') ``` -------------------------------- ### Publish Cookie Consent Views Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Run this artisan command to publish the package's views for customization. The views are copied to resources/views/vendor/laravel-cookie-consent/. ```bash php artisan vendor:publish --tag=laravel-cookie-consent-views ``` -------------------------------- ### Test Blade views rendering Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Pest tests verifying that the cookie-consent-head view contains a stylesheet link and the cookie-consent-body view contains the cookieconsent.initialise script with palette, position, and theme settings. ```php use function Pest\Laravel\get; it('renders cookie consent head view', function () { $view = view('laravel-cookie-consent::cookie-consent-head')->render(); expect($view)->toContain('render(); expect($view) ->toContain('cookieconsent.initialise') ->toContain('"palette"') ->toContain('"position"') ->toContain('"theme"'); }); ``` -------------------------------- ### Update CookieConsentSettings Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Update settings at runtime and save them. ```php $settings = cookie_consent_settings(); $settings->position = 'top-right'; $settings->popup_background = '#000000'; $settings->save(); ``` -------------------------------- ### Access CookieConsentSettings Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/README.md Access settings via the helper function or the container, and read a value. ```php use JeffersonGoncalves\CookieConsent\Settings\CookieConsentSettings; // Via helper $settings = cookie_consent_settings(); // Via container $settings = app(CookieConsentSettings::class); // Read a value $position = $settings->position; ``` -------------------------------- ### Test service provider registration Source: https://github.com/jeffersongoncalves/laravel-cookie-consent/blob/master/resources/boost/skills/cookie-consent-development/SKILL.md Pest test verifying that the CookieConsentSettings class is registered in the config settings array. ```php it('registers settings class in config', function () { $settings = config('settings.settings'); expect($settings)->toContain(CookieConsentSettings::class); }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.