<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ginkelsoft / laravel-data-subject-access example snippets
use Ginkelsoft\DataSubjectAccess\Attributes\Exportable;
use Ginkelsoft\DataSubjectAccess\Concerns\Exportable as ExportableTrait;
use Ginkelsoft\DataSubjectAccess\Contracts\Exportable as ExportableContract;
#[Exportable(column: 'id')]
class User extends Model implements ExportableContract
{
use ExportableTrait;
protected array $exportable = [
'fields' => [
'id' => 'Subject identifier',
'email' => 'E-mailadres',
],
];
}
class Profile extends Model implements ExportableContract
{
use ExportableTrait;
protected array $exportable = [
'column' => 'user_id',
'fields' => [
'first_name' => 'Voornaam',
'last_name' => 'Achternaam',
'email' => ['label' => 'E-mailadres'],
'logged_in_at' => [
'label' => 'Aangemeld op',
'transform' => fn ($v) => $v?->format('Y-m-d H:i:s'),
],
// internal_note is intentionally not listed: it stays out of the export.
],
];
}
use Ginkelsoft\DataRightToBeForgotten\Attributes\Forgettable as ForgettablePolicy;
use Ginkelsoft\DataRightToBeForgotten\Concerns\Forgettable;
use Ginkelsoft\DataRightToBeForgotten\Contracts\Forgettable as ForgettableContract;
use Ginkelsoft\DataSubjectAccess\Attributes\Exportable as ExportablePolicy;
use Ginkelsoft\DataSubjectAccess\Concerns\Exportable;
use Ginkelsoft\DataSubjectAccess\Contracts\Exportable as ExportableContract;
#[ExportablePolicy(column: 'id')]
#[ForgettablePolicy(column: 'id', action: 'delete')]
class User extends Model implements ExportableContract, ForgettableContract
{
use Exportable, Forgettable;
protected array $exportable = [
'fields' => [
'id' => 'Subject identifier',
'email' => 'E-mailadres',
],
];
}