public function updatePreferences(string $key, $data)
    {
        $current = $this->preferences;

        $this->preferences = PreferencesParser::parse($current)->update($key, $data)->toJson();

        $this->save();
    }
public function updatePreferences(string $key, $data)
    {
        $current = $this->preferences;

        $this->preferences = PreferencesParser::parse($current)->update($key, $data)->toJson();

        $this->save();
    }
public function updatePreferences ( string $ key , $ data ) { $ current = $ this -> preferences ; $ this -> preferences = PreferencesParser :: parse ( $ current ) -> update ( $ key , $ data ) -> toJson ( ) ; $ this -> save ( ) ; }
Updates the user's preferences for the given key.

@param  string $key
@param  mixed $data

@return void
Updates the user s preferences for the given key .