I can't create download in a specific instance
Ifriqiya opened this issue · 0 comments
Hi, I get this error: 'Spatie\PersonalDataExport\Exceptions\InvalidUser
Could not create a personal data download for App\Models\User
because it does have an email property.' when I call the create personal data export job. My user model already implements the ExportsPersonalData trait and I called the dispatch job like this: return dispatch(new CreatePersonalDataExportJob($user)); I get the same error with a controller or a closure.
This is my closure: Route::middleware(['auth:sanctum', 'verified'])->post('/user/export-personal-data', function (User $user) {
return dispatch(new CreatePersonalDataExportJob($user));
})->name('user.export-personal-data');
When I use: return dispatch(new CreatePersonalDataExportJob(auth()->user())); I get 'Expected type 'Spatie\PersonalDataExport\ExportsPersonalData'. Found 'Illuminate\Contracts\Auth\Authenticable|null', and a different error message.
Interestingly, when I call: return dispatch(new CreatePersonalDataExportJob($user)); in an existing Jetstream DeleteUser class, I get the email with the zip file and in storage.
Thanks.