更新用户设置表 - Laravel

Trying to update a table that holds a user's settings. I have a hasOne usersetting relation setup in the user model. The usersetting table doesn't have a id column. But Im getting this error.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: update usersettings set user_name = u9ddf, usersettings.updated_at = 2019-04-30 02:13:37 where id is null).

public function profileupdate(Request $request)
{
    if($user = Auth::user())
    {
        $usersetting = $user->usersetting;
        $usersetting->update([
            'user_name' => $request->input('profile_name')
        ]);


        return redirect('profilesettings');
    }


}

I guess Im not querying correctly with eloquent?

I figured it out. Had to set user_id as a primary key in usersetting model.

public $primaryKey  = 'user_id';

Add the following in model usersetting:

protected $primaryKey  = 'user_id';