Skip to content

Commit 4bf0e84

Browse files
authored
Merge pull request #9 from VanOns/bugfix/anonymize-users
fix: properly retrieve and use user model
2 parents e0be320 + 91cda6c commit 4bf0e84

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/Processors/AnonymizeUsers.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@ public function tables(): array
1717

1818
public function process(): void
1919
{
20+
if (empty($userModel = $this->getUserModel())) {
21+
return;
22+
}
23+
2024
/** @var Authenticatable|Model $user */
21-
foreach ($this->getUserModel()->query()->cursor() as $user) {
25+
foreach ($userModel::query()->cursor() as $user) {
2226
$data = [];
2327

2428
/** @phpstan-ignore-next-line */
@@ -48,11 +52,9 @@ public function process(): void
4852
/**
4953
* Get the user model.
5054
*/
51-
protected function getUserModel(): Authenticatable|Model
55+
protected function getUserModel(): ?string
5256
{
53-
$model = config('auth.providers.users.model');
54-
55-
return app($model);
57+
return config('auth.providers.users.model');
5658
}
5759

5860
/**

0 commit comments

Comments
 (0)