I am trying to migrate some users from my legacy system to the new one that I am currently building. For that purpose, I have decided to reset the user's passwords and send them a link to update it.
//use ResetsPasswords;
foreach ($oldUsers as $oldUser) {
if (!in_array($oldUser->email, $this->duplicateUsersEmails)) {
$this->processingUserId = $oldUser->id;
$olduserAccounts = OldUsers_MyAccounts::where('user_id', $this->processingUserId)->first();
NewUser::create(
[
'createdAt' => $oldUser->created,
'updatedAt' => $oldUser->modified,
'email' => $oldUser->email,
'username' => $oldUser->username,
'password' => Hash::make(time().$oldUser->email),
'activated' => 0,
'lastLogin' => $oldUser->lastlogin,
'firstname' => $oldUser->forename,
'lastName' => $oldUser->surname,
'dob' => $oldUser->dob,
'titleId' => 0,
'balance' => ($olduserAccounts !== null) ? $olduserAccounts->currency_balance : 0,
'creditBalance' => ($olduserAccounts !== null) ? $olduserAccounts->monies_balance : 0,
'migrated' => 1,
]
);
}
$request = request()->merge(array('email' => $oldUser->email));
$this->postEmail($request);
}
Thing is that most of the online resources are effectively around creating controllers, routes etc for this but wondering if there is a simpler way to achieve this. What I'd like to do, is to reset the password and fire off an email with a Password Reset link straightaway.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire