How do i attach a an element to user account? I have added a custom form element in login form. I need to link this new element to user account on logging in.

I need to add and get entry to the table "users_data" in Drupal 8. 
This can be done by defining a class EmployeeDetails and then fetch the value like this :

$employee_details = new EmployeeDetails($account);
$employee_details-&gt;setEmployeeNumber($value);


My Question is in which file should i define EmployeeDetails class? What should be file name, should i use .inc extension and where in the module should be this file placed?
As reported in users.data column replaced with user_data API, the equivalent of using the user.data column, in Drupal 8, is using the user.data service.

So, if in Drupal 7 you used $value = $account-&gt;data['mymodule_xyz'];, in Drupal 8 you will use the following code.

$value = \Drupal::service('user.data')-&gt;get('mymodule', $account-&gt;id(), 'xyz');


The code to set its value is the following one.

\Drupal::service('user.data')-&gt;set('mymodule', $account-&gt;id(), 'xyz', $value);


As usual, when possible, use dependency injection to get the service, instead of using the \Drupal class.