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

Commit f86eba8

Browse files
committed
Fixed overwriting first user
- No new query object was created when calling methods upon the model, so the first model was always returned. - Closes #258 & #258
1 parent c14a992 commit f86eba8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Auth/Importer.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,22 @@ protected function findByCredentials(Model $model, array $credentials = [])
5757
return;
5858
}
5959

60-
if (method_exists($model, 'trashed')) {
60+
$query = $model->newQuery();
61+
62+
if ($query->getMacro('withTrashed')) {
6163
// If the trashed method exists on our User model, then we must be
6264
// using soft deletes. We need to make sure we include these
6365
// results so we don't create duplicate user records.
64-
$model = $model->withTrashed();
66+
$query->withTrashed();
6567
}
6668

6769
foreach ($credentials as $key => $value) {
6870
if (! Str::contains($key, 'password')) {
69-
$model->where($key, $value);
71+
$query->where($key, $value);
7072
}
7173
}
7274

73-
return $model->first();
75+
return $query->first();
7476
}
7577

7678
/**

0 commit comments

Comments
 (0)