Skip to content

Commit

Permalink
Fix blank emails in exports
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksleight committed Sep 4, 2023
1 parent e1cd6b4 commit a8d9e18
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/Exporters/AbstractExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ protected function getKeys()
{
return User::blueprint()
->fields()
->except(['id', 'groups', 'roles', 'password'])
->except(['groups', 'roles'])
->all()
->keys()
->merge(['id', 'last_login'])
->merge(User::getComputedCallbacks()->keys())
->merge(['id', 'last_login'])
->reject('password')
->all();
}

protected function getData()
{
return Member::query()->get()
->map(function ($user) {
$data = $user->data();
$computedData = $user->computedData();

return collect($this->getKeys())
->flip()
->map(function ($field, $key) use ($data, $computedData) {
return $data[$key] ?? $computedData[$key] ?? null;
})
$data = $user->data()
->merge($user->computedData())
->merge([
'id' => $user->id(),
'email' => $user->email(),
'last_login' => $user->lastLogin(),
])
]);

return collect($this->getKeys())
->flip()
->map(fn ($field, $key) => $data->get($key))
->all();
})
->all();
Expand Down

0 comments on commit a8d9e18

Please sign in to comment.