我正在尝试用这个包抓取用户信息:https://github.com/invisnik/laravel-steam-auth,但我完全是laravel atm的新手。
如何在名为'steamid‘的Auth::steamID64 ()字段中存储用户
我的以下处理自动柜员机:
public function handle()
{
if ($this->steam->validate()) {
$info = $this->steam->getSteamId();
if (!is_null($info)) {
//I should store the steamid64 inside the Auth::user() field named 'steamid'
return redirect($this->redirectURL); // redirect to site
}
}
return $this->redirectToSteam();
}我希望有人能给我指引正确的方向。提前感谢
发布于 2020-02-01 17:53:21
您可以使用save()完成此操作
Auth::user()->steamid = $info;
Auth::user()->save();或者使用update()
Auth::user()->update(['steamid' => $info]);要检查数据库中是否已存在steamid,请执行以下操作:
$isAlreadyPresent = User::where('id', '!=', Auth::id())->where('steamid', '=', $info)->count();如果$isAlreadyPresent为零,则数据库中没有steamid,或者它是当前用户steamid。
https://stackoverflow.com/questions/60007205
复制相似问题