Closed paparyku closed 7 years ago
It's something you have to do in your implementation.
if ($this->steam->validate()) {
$info = $this->steam->getUserInfo();
if (!is_null($info)) {
$user = User::where('steamid', $info->steamID64)->first();
if (is_null($user)) {
$user = User::create([
'username' => $info->personaname,
'avatar' => $info->avatarfull,
'steamid' => $info->steamID64
]);
} else {
$user->update([
'username' => $info->personaname,
]);
}
Auth::login($user, true);
return redirect('/'); // redirect to site
}
}
or if you want to prevent an else
and want to keep everything in sync:
if ($this->steam->validate()) {
$info = $this->steam->getUserInfo();
if (!is_null($info)) {
$user = new User([
'username' => $info->personaname,
'avatar' => $info->avatarfull,
'steamid' => $info->steamID64
]);
$user->save();
Auth::login($user, true);
return redirect('/'); // redirect to site
}
}
Thanks for the help!
My current issue is when a user logs back into the application from logging out I need it to check if the users steam nickname has changed if so it will update it in mysql database. Hopefully there's a way to fix this and or add this to the package itself. Thank you!