The user column.

@param stdClass $data The row data.
@return mixed
338800
public function col_userid($data) {
        $user = $data->foruser;
        return html_writer::link($user->profileurl, $user->fullname, ['title' => get_string('viewprofile')]);
    }
1109505
public function get_label($data) {
        global $DB;

        $role = $DB->get_record('role', array('id' => $data['value']));

        $a = new stdClass();
        $a->label = $this->_label;
        $a->value = '"'.role_get_name($role).'"';

        return get_string('globalrolelabel', 'filters', $a);
    }
1249957
public function optimize (stdClass $data)
    {
        $data->translationFilePrefix = $this->stringWithUnderscore ($data->serviceURL);

        $data->translationFilePrefix = $this->stringWithUnderscore ($data->translationFilePrefix);
        $data->translationsLocation = $this->getTranslationPrefix ($data) . $data->translationFilePrefix;

        return $data;
    }
869588
protected function create(array $data)
  {
    //Ceate User
    $user = User::create([
      'name' => $data['name'],
      'email' => $data['email'],
      'password' => bcrypt($data['password']),
    ]);

    //create Blank profile
    $profile = Profile::create([
      'user_id' => $user->id,
      'bio'     => '',
    ]);
    $profile->save();

    //Assign User Role
    $user->assign('user');
    return $user;
  }
638453
public function optimize (stdClass $data)
    {
        $data->formName = $data->serviceName . 'Form';
        $data->formNameSpace = str_replace ('\\http\\controllers', '\\forms', $data->controllerNamespace);
        $data->formDestination = str_replace ('/http/controllers', '/forms', $data->controllerDestination) . '/' . $data->formName . '.php';
        $data->formID = $this->stringWithDash ($data->serviceURL);

        return $data;
    }
241045
final public static function getInstance($data=null)
    {
        $class = get_called_class();
        if (empty($class)) return null;

        if (!isset(self::$_instance)){
            self::$_instance = new $class($data);
        }

        return self::$_instance;
    }
497628
public function reset_userdata(stdClass $data) {

        $componentstr = get_string('pluginname', 'workshop').': '.format_string($this->name);
        $status = array();

        if (!empty($data->reset_workshop_assessments) or !empty($data->reset_workshop_submissions)) {
            // Reset all data related to assessments, including assessments of
            // example submissions.
            $result = $this->reset_userdata_assessments($data);
            if ($result === true) {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetassessments', 'mod_workshop'),
                    'error' => false,
                );
            } else {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetassessments', 'mod_workshop'),
                    'error' => $result,
                );
            }
        }

        if (!empty($data->reset_workshop_submissions)) {
            // Reset all remaining data related to submissions.
            $result = $this->reset_userdata_submissions($data);
            if ($result === true) {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetsubmissions', 'mod_workshop'),
                    'error' => false,
                );
            } else {
                $status[] = array(
                    'component' => $componentstr,
                    'item' => get_string('resetsubmissions', 'mod_workshop'),
                    'error' => $result,
                );
            }
        }

        if (!empty($data->reset_workshop_phase)) {
            // Do not use the {@link workshop::switch_phase()} here, we do not
            // want to trigger events.
            $this->reset_phase();
            $status[] = array(
                'component' => $componentstr,
                'item' => get_string('resetsubmissions', 'mod_workshop'),
                'error' => false,
            );
        }

        return $status;
    }
465164
protected static function convert_fields(\stdClass $data) {
        $data = parent::convert_fields($data);

        if (!empty($data->lawfulbases) && is_array($data->lawfulbases)) {
            $data->lawfulbases = implode(',', $data->lawfulbases);
        }
        if (!empty($data->sensitivedatareasons) && is_array($data->sensitivedatareasons)) {
            $data->sensitivedatareasons = implode(',', $data->sensitivedatareasons);
        }

        // A single value.
        $data->retentionperiod = 'P' . $data->retentionperiodnumber . $data->retentionperiodunit;
        unset($data->retentionperiodnumber);
        unset($data->retentionperiodunit);

        return $data;
    }
125616
public static function create_user_field_mapping($data) {
        require_capability('moodle/site:config', context_system::instance());
        $userfieldmapping = new user_field_mapping(0, $data);

        // Will throw exceptions on validation failures.
        $userfieldmapping->create();
        return $userfieldmapping;
    }
724416
public function create($data) {
		$dt = $this->getDataTable();
		
		if (! $dt)
			return $this->createResponse($this->getNameManager()->getTableNames(), 401, "Tabels");
		
		return $this->createResponse([], 200, "{$this->getNameManager()->entityName}: No Create");
	}
980263
public function updateUser($data) {
        $user = $this->getFind($data['id']);

        $user->name       = $data['name'];
        $user->email      = $data['email'];

        // The password need not be changed
        if ($data['password'] != "") {
            $user->password   = bcrypt($data['password']);
        }

        if ($data['activated'] != "1") {
            $user->activated = 0;
        }

        if ($data['enabled'] != "1") {
            $user->enabled = 0;
        }

        // two factor authorization
        if ($data['two_factor_auth_enabled'] != "1") {
            $user->two_factor_auth_enabled = 0;
        } else {
            $user->two_factor_auth_enabled = 1;
        }
        $user->phone_country_code      = $data['phone_country_code'];
        $user->phone_number            = $data['phone_number'];


        $user->created_by  = Auth::user()->id;
        $user->updated_by  = Auth::user()->id;

        $saveWentOk = $user->save();

        // If the save to the database table went ok, then let's UPDATE/INSERT related IDs into the pivot tables,
        if ($saveWentOk) {
            // INSERT into the pivot table
            $this->associateRelatedRecordsToUpdatedRecord(
                $user,
                $data['groups'],
                'Group'
            );

            return true;
        }

        return false;
    }
1351207
protected function toObject($data)
	{
		$obj = new stdClass;

		foreach ($data as $key => $datum)
		{
			if (is_array($datum))
			{
				$obj->$key = $this->toObject($datum);
			}
			else
			{
				$obj->$key = $datum;
			}
		}

		return $obj;
	}
594226
public function col_requestedby($data) {
        $user = $data->requestedbyuser;
        return html_writer::link($user->profileurl, $user->fullname, ['title' => get_string('viewprofile')]);
    }
642025
public function col_team(stdClass $row) {
        $submission = false;
        $group = false;
        $this->get_group_and_submission($row->id, $group, $submission, -1);
        if ($group) {
            return $group->name;
        } else if ($this->assignment->get_instance()->preventsubmissionnotingroup) {
            $usergroups = $this->assignment->get_all_groups($row->id);
            if (count($usergroups) > 1) {
                return get_string('multipleteamsgrader', 'assign');
            } else {
                return get_string('noteamgrader', 'assign');
            }
        }
        return get_string('defaultteam', 'assign');
    }
1272860
public function get_role_overrides_from_data(\stdClass $data) {
        $overrides = [];
        if (!empty($data->overrides)) {
            $searchkey = 'roleoverride_';

            for ($i = 0; $i < $data->overrides; $i++) {
                $overridedata = (object) [];
                foreach ((array) $data as $fieldname => $value) {
                    if (strpos($fieldname, $searchkey) !== 0) {
                        continue;
                    }

                    $overridefieldname = substr($fieldname, strlen($searchkey));
                    $overridedata->$overridefieldname = $value[$i];
                }

                if (empty($overridedata->roleid) || empty($overridedata->retentionperiodnumber)) {
                    // Skip this one.
                    // There is no value and it will be delete.
                    continue;
                }

                $override = static::convert_fields($overridedata);

                $overrides[$i] = $override;
            }
        }

        return $overrides;
    }
760055
public function createUser(array $data) : User
    {
        $data['password'] = Hash::make($data['password']);
        return $this->create($data);
    }
576727
protected function create(array $data)
    {
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => $data['password'],
            'last_ip' => request()->ip(),
            // Only 'user'.
            'role' => 'user',
        ]);

        return $user;
    }