调用未定义的方法Illuminate \ Auth \ GenericUser :: save()

时间:2019-12-14 16:33:29

标签: laravel authentication laravel-5 error-handling

登录后,我尝试通过Blip中的表单更新用户个人资料。这是代码:

a:blip

但是在出现此错误

var blip = cells[1].Descendants<Blip>().FirstOrDefault();

我的用户模型未更改。 有人能发现错误吗?

2 个答案:

答案 0 :(得分:0)

您那里没有用户模型,您有GernericUser。您已将auth配置更改为不使用用户模型。您已将用户提供者设置为使用database驱动程序而不是eloquent驱动程序。

答案 1 :(得分:0)

public function update(Request $request)
    {
            $user = \App\User::find(Auth::id());
            $user->first_name = $request->first_name;
            $user->last_name = $request->last_name;
            $user->username = $request->username;
            $user->email = $request->email;
            $user->phone_no = $request->phone_no;
            $user->division_id = $request->division_id;
            $user->district_id = $request->district_id;
            $user->street_address = $request->street_address;
            $user->shipping_address = $request->shipping_address;
            if ( !empty($request->password) ) {
                $user->password = Hash::make($request->password);
            }
            $user->save();
            session()->flash('success','user profile has been updated');
            return back();
    }