我在laravel中成功创建了JWT登录和注册表单, 但是当我想使用此功能更新用户详细信息时,日志系统显示此错误:
local.ERROR: Object of class Tymon\JWTAuth\JWTGuard could not be converted to string {"userId":1,"exception":"[object] (ErrorException(code: 0): Object of class Tymon\\JWTAuth\\JWTGuard could not be converted to string at C:\\xampp\\htdocs\\lara\\vendor\\laravel\\framewo
这是更新的主要功能:
public function updateAuthUser (Request $request)
{
$user = User::find(auth('api'));
$user->name = $request->name;
$user->email = $request->email;
$user->phone = $request->phone;
$user->mobile = $request->mobile;
$user->sex = $request->sex;
if ($request->password) {
$user->password = $request->password;
};
$user->save();
return $user;
}