Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Aug 1, 2021
1 parent 4eb751d commit 175f7ec
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 32 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

All notable changes to `personal-data-export` will be documented in this file

## 3.0.0 - 2021-08-01

- improve translations
- refactor internals

## 2.0.2 - 2021-05-05

- deps: update spatie/temporary-directory (#57)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function schedule(Schedule $schedule)
Optionally, you can publish the config file with:

```php
php artisan vendor:publish --provider="Spatie\PersonalDataExport\PersonalDataExportServiceProvider" --tag="config"
php artisan vendor:publish --provider="Spatie\PersonalDataExport\PersonalDataExportServiceProvider" --tag="personal-data-export-config"
```

This is the content of the config file, which will be published at `config/personal-data-export.php`:
Expand Down Expand Up @@ -203,12 +203,12 @@ When the user clicks the download link in the mail that gets sent after creating

If you don't want to enforce that a user should be logged in to able to download a personal data export, you can set the `authentication_required` config value to `false`. Setting the value to `false` is less secure because anybody with a link to a zip file will be able to download it, but because the name of the zip file contains many random characters, it will be hard to guess it.

### Translate the mail
### Translating the notification

You need to publish the translations:

```bash
php artisan vendor:publish --provider="Spatie\PersonalDataExport\PersonalDataExportServiceProvider" --tag="translations"
php artisan vendor:publish --provider="Spatie\PersonalDataExport\PersonalDataExportServiceProvider" --tag="personal-data-export-translations"
```

### Customizing the mail
Expand Down Expand Up @@ -315,4 +315,4 @@ If you discover any security related issues, please email [email protected] instea

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"illuminate/queue": "^8.0",
"illuminate/support": "^8.0",
"nesbot/carbon": "^2.14",
"spatie/laravel-package-tools": "^1.9",
"spatie/temporary-directory": "^2.0"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/en/notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

return [
'subject' => 'Personal Data Download',
'instructions' => 'Please click the button below to download a zip file containg all data we got for your account.',
'instructions' => 'Please click the button below to download a zip file containing all data we got for your account.',
'action' => 'Download Zip File',
'deletion_message' => 'This file will be deleted at :date.',
];
41 changes: 14 additions & 27 deletions src/PersonalDataExportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,26 @@

use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Spatie\PersonalDataExport\Commands\CleanOldPersonalDataExportsCommand;
use Spatie\PersonalDataExport\Http\Controllers\PersonalDataExportController;

class PersonalDataExportServiceProvider extends ServiceProvider
class PersonalDataExportServiceProvider extends PackageServiceProvider
{
public function boot()
public function configurePackage(Package $package): void
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__ . '/../config/personal-data-export.php' => config_path('personal-data-export.php'),
], 'config');
}

Route::macro('personalDataExports', function (string $url) {
Route::get("$url/{zipFilename}", '\Spatie\PersonalDataExport\Http\Controllers\PersonalDataExportController@export')
->name('personal-data-exports');
});

$this->loadTranslationsFrom(
__DIR__ . '/../resources/lang/',
"personal-data-export"
);

$this->publishes([
__DIR__ . '/../resources/lang' => resource_path("lang/vendor/personal-data-export"),
], "translations");

$this->commands([
CleanOldPersonalDataExportsCommand::class,
]);
$package
->name('laravel-personal-data-export')
->hasConfigFile()
->hasCommand(CleanOldPersonalDataExportsCommand::class)
->hasTranslations();
}

public function register()
public function packageBooted()
{
$this->mergeConfigFrom(__DIR__ . '/../config/personal-data-export.php', 'personal-data-export');
Route::macro('personalDataExports', function (string $url) {
Route::get("$url/{zipFilename}", [PersonalDataExportController::class, 'export'])->name('personal-data-exports');
});
}
}

0 comments on commit 175f7ec

Please sign in to comment.