Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit f045705

Browse files
committed
Fixed retrieving the existing users model during import.
1 parent 4114c1c commit f045705

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/Commands/Import.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ public function import(array $users = [])
104104

105105
foreach ($users as $user) {
106106
try {
107+
// Get the users credentials array.
108+
$credentials = $this->getUserCredentials($user);
109+
107110
// Import the user and retrieve it's model.
108-
$model = $this->getImporter()->run($user, $this->model());
111+
$model = $this->getImporter()->run($user, $this->model(), $credentials);
109112

110113
$password = str_random();
111114

@@ -224,6 +227,20 @@ public function getUsers()
224227
});
225228
}
226229

230+
/**
231+
* Returns the specified users credentials array.
232+
*
233+
* @param User $user
234+
*
235+
* @return array
236+
*/
237+
protected function getUserCredentials(User $user)
238+
{
239+
return [
240+
$this->getResolver()->getEloquentUsername() => $user->getFirstAttribute($this->getResolver()->getLdapUsername())
241+
];
242+
}
243+
227244
/**
228245
* Saves the specified user with its model.
229246
*

0 commit comments

Comments
 (0)