PHP code example of elvinqulizade / filament-gdpr

1. Go to this page and download the library: Download elvinqulizade/filament-gdpr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

elvinqulizade / filament-gdpr example snippets


return [

    'user_model' => \App\Models\User::class,
    'user_identifier' => 'email',

    'disk' => 'local',
    'export_prefix' => 'gdpr-exports',

    'delete_mode' => 'soft', // soft | force

    'allow_unique_overwrite' => false,
    'default_strategy' => 'mask',

    'models' => [],

    'model_discovery' => [
        'exclude' => [],
    ],

    'navigation_group' => 'Privacy',

    'schedule' => [
        'enabled' => env('FILAMENT_GDPR_SCHEDULE', true),
        'frequency' => 'daily', // everyMinute | hourly | everyTwoHours | everySixHours | daily | weekly | monthly
    ],

];

use ElvinQulizade\Gdpr\GdprPlugin;

->plugins([
    GdprPlugin::make()
        ->navigationGroup('Privacy')
        ->statisticsWidget(true),
])

use ElvinQulizade\Gdpr\Enums\RetentionAction;
use ElvinQulizade\Gdpr\Enums\RetentionPeriodUnit;
use ElvinQulizade\Gdpr\Models\RetentionPolicy;

RetentionPolicy::create([
    'name' => 'Order history',
    'model_class' => \App\Models\Order::class,
    'retention_column' => 'created_at',
    'retention_period' => 24,
    'period_unit' => RetentionPeriodUnit::Months,
    'action' => RetentionAction::Anonymize,
    'anonymize_fields' => ['customer_email' => 'email', 'customer_name' => 'mask'],
    'enabled' => true,
]);

use ElvinQulizade\Gdpr\Facades\Gdpr;

Gdpr::policies();                // enabled policies
Gdpr::run();                     // run the privacy sweep (respects dry-run config)
Gdpr::anonymize($model, []);     // anonymize a single model instance
Gdpr::exporter()->export('[email protected]'); // create an export for a subject
css
@source '../../../../vendor/elvinqulizade/filament-gdpr/resources/**/*.blade.php';
bash
php artisan vendor:publish --tag="filament-gdpr-migrations"
php artisan migrate
bash
php artisan vendor:publish --tag="filament-gdpr-config"
bash
php artisan privacy:run
php artisan privacy:run --policy=12 --dry-run
bash
php artisan privacy:export [email protected]