Skip to content

Commit

Permalink
chore: update for gdpr beta 18 (#93)
Browse files Browse the repository at this point in the history
* chore: update for gdpr 18

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <[email protected]>
  • Loading branch information
imorland and StyleCIBot authored Oct 30, 2023
1 parent fdb2a8f commit a8d0658
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Data/Drafts.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
use Blomstra\Gdpr\Data\Type;
use FoF\Drafts\Draft;
use Illuminate\Support\Arr;
use PhpZip\ZipFile;

class Drafts extends Type
{
Expand All @@ -23,16 +22,17 @@ public static function exportDescription(): string
return 'All drafts created by the user.';
}

public function export(ZipFile $zip): void
public function export(): ?array
{
$dataExport = [];

Draft::query()
->where('user_id', $this->user->id)
->each(function (Draft $draft) use ($zip) {
$zip->addFromString(
"drafts/draft-{$draft->id}.json",
$this->encodeForExport($this->sanitize($draft))
);
->each(function (Draft $draft) use (&$dataExport) {
$dataExport[] = ["drafts/draft-{$draft->id}.json" => $this->encodeForExport($this->sanitize($draft))];
});

return $dataExport;
}

protected function sanitize(Draft $draft): array
Expand Down

0 comments on commit a8d0658

Please sign in to comment.