use Auth to create a new user, in case we've received enough information to do so

@param  array  array with the raw Opauth response user fields

@return  mixed  id of the user record created, or false if the create failed
327044
protected function create_user(array $user)
	{
		$user_id = \Auth::create_user(

			// username
			isset($user['nickname']) ? $user['nickname'] : null,

			// password (random string will do if none provided)
			isset($user['password']) ? $user['password'] : \Str::random(),

			// email address
			isset($user['email']) ? $user['email'] : null,

			// which group are they in?
			\Config::get('opauth.default_group', -1),

			// extra information
			array(

				// got their name? full name? or first and last to make up a full name?
				'fullname' => isset($user['name']) ? $user['name'] : (
					isset($user['full_name']) ? $user['full_name'] : (
						isset($user['first_name'], $user['last_name']) ? $user['first_name'].' '.$user['last_name'] : null
					)
				),
			)
		);

		return $user_id ?: false;
	}
1248322
protected function createModelFromArray(array $array)
    {
        $account = new SEPAAccount();
        $account->setIban($array[1]);
        $account->setBic($array[2]);
        $account->setAccountNumber($array[3]);
        $account->setSubAccount($array[4]);
        $account->setBlz($array[6]);

        return $account;
    }
849048
public static function createFromArray(array $array): self
    {
        if (!isset($array['uuid'], $array['app_id'])) {
            throw InvalidFormatException::indexFormatNotValid();
        }

        return new self(
            IndexUUID::createFromArray($array['uuid']),
            AppUUID::createFromArray($array['app_id']),
            $array['is_ok'] ?? false,
            $array['doc_count'] ?? 0,
            $array['size'] ?? '0kb',
            $array['shards'] ?? Config::DEFAULT_SHARDS,
            $array['replicas'] ?? Config::DEFAULT_REPLICAS,
            $array['fields'] ?? [],
            $array['metadata'] ?? []
        );
    }
64491
protected function create(array $data)
    {
        return User::create([
            'first_name' => $data['first_name'],
            'last_name' => $data['last_name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
    }
771970
public function create($params = array())
    {
        $arr = array(
            "bank_name" => $params["bank_name"],
            "branch_name" => $params["branch_name"],
            "bank_account_type" => $params["bank_account_type"],
            "number" => $params["number"],
            "name" => $params["name"]
        );
        $rawResponse = $this->client->request('post', 'api/bank_accounts', $arr);
        return $rawResponse;
    }
831447
public function actionCreate()
    {
        $model = new User();

        if ($model->loadAll(request()->post())) {
            $model->setPassword($model->password_hash);
            $model->generateAuthKey();
            if ($model->saveAll()) {
                set_flash('success_create_new_user', $array = [
                    'type'     => 'success',
                    'duration' => 3000,
                    'icon'     => 'glyphicon glyphicon-ok-sign',
                    'title'    => \t('app', 'Congratulations!'),
                    'message'  => \t('app','Your content has been saved'),
                ]);
                return $this->redirect(['update', 'id' => $model->id]);
            } else {
                set_flash('error_user_has_not_been_saved', $array = [
                    'type'     => 'danger',
                    'duration' => 3000,
                    'icon'     => 'glyphicon glyphicon-remove-sign',
                    'title'    => \t('app', 'An error has occurred!'),
                    'message'  => \t('app','Your content has not been saved'),
                ]);
            }
        }

        return $this->render('create', [
            'model' => $model,
        ]);

    }
1033793
public function create_user($username, $password, $email, $group = 1, Array $profile_fields = array())
	{
		$password = trim($password);
		$email = filter_var(trim($email), FILTER_VALIDATE_EMAIL);

		if (empty($username) or empty($password) or empty($email))
		{
			throw new \SimpleUserUpdateException('Username, password or email address is not given, or email address is invalid', 1);
		}

		$same_users = \DB::select_array(\Config::get('simpleauth.table_columns', array('*')))
			->where('username', '=', $username)
			->or_where('email', '=', $email)
			->from(\Config::get('simpleauth.table_name'))
			->execute(\Config::get('simpleauth.db_connection'));

		if ($same_users->count() > 0)
		{
			if (in_array(strtolower($email), array_map('strtolower', $same_users->current())))
			{
				throw new \SimpleUserUpdateException('Email address already exists', 2);
			}
			else
			{
				throw new \SimpleUserUpdateException('Username already exists', 3);
			}
		}

		$user = array(
			'username'        => (string) $username,
			'password'        => $this->hash_password((string) $password),
			'email'           => $email,
			'group'           => (int) $group,
			'profile_fields'  => serialize($profile_fields),
			'last_login'      => 0,
			'login_hash'      => '',
			'created_at'      => \Date::forge()->get_timestamp()
		);
		$result = \DB::insert(\Config::get('simpleauth.table_name'))
			->set($user)
			->execute(\Config::get('simpleauth.db_connection'));

		return ($result[1] > 0) ? $result[0] : false;
	}
1173633
public function create(array $credentials)
	{
		$user = $this->createModel();
		$user->fill($credentials);
		$user->save();

		return $user;
	}
743019
private function createLoginView(array $data)
    {
        // Get the client that we're rendering login for
        $consentType = $this->getConsentType($this->getAuthorizationRequest());

        switch ($consentType) {
            case Client::CONSENT_NONE:
                // Don't set anything if the consent type is "none"
                break;

            case Client::CONSENT_SIMPLE:
            default:
                $data['consentView'] = new View('/oauth/consent/simple');
                break;
        }

        // Start building a view:
        $contents = new View('/oauth/authorize');
        $contents->setViewTheme('concrete');
        $contents->setViewTemplate('background_image.php');
        $contents->addScopeItems($data);

        return $contents;
    }
331214
public function createWebWallet(array $array)
    {
        $this->formatRequest($array);
        $WSRequest = array(
            'contractNumber'           => $array['contractNumber'],
            'selectedContractList'     => $array['contracts'],
            'updatePersonalDetails'    => $array['updatePersonalDetails'],
            'buyer'                    => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
            'languageCode'             => $array['languageCode'],
            'customPaymentPageCode'    => $array['customPaymentPageCode'],
            'securityMode'             => $array['securityMode'],
            'returnURL'                => $array['returnURL'],
            'cancelURL'                => $array['cancelURL'],
            'notificationURL'          => $array['notificationURL'],
            'privateDataList'          => $this->privateData,
            'customPaymentTemplateURL' => $array['customPaymentTemplateURL'],
            'contractNumberWalletList' => $array['walletContracts']
        );
        return $this->webServiceRequest($array, $WSRequest, self::WEB_API, 'createWebWallet');
    }
264603
public function addToIdentity($array)
    {
        if ($this->instance instanceof \Phavour\Session\Storage) {
            if ($this->instance->isLocked()) {
                $this->instance->unlock();
            }
            $temp = $this->instance->get('identity');
            if (!$temp) {
                $temp = array();
            }
            $newIdentity = array_merge($temp, $array);
            $this->instance->set('identity', $newIdentity);
            $this->instance->lock();
            return true;
        }

        return false;
    }
666281
protected function create(array $data)
    {
        $admin = new Admin();

        $fields           = $this->tableFields();
        $data['password'] = bcrypt($data['password']);
        foreach ($fields as $field) {
            if (isset($data[$field])) {
                $admin->$field = $data[$field];
            }
        }

        $admin->save();
        $admin->roles()->sync(request('role_id'));
        $this->sendConfirmationNotification($admin, request('password'));

        return $admin;
    }
5384
public static function create(array $params)
    {
        $publicKey = $params[self::PublicKey];
        $privateKey = $params[self::PrivateKey];

        $cardParams = new self($publicKey, $privateKey);

        if (array_key_exists(self::Identity, $params)) {
            $cardParams->identity = $params[self::Identity];
        }
        if (array_key_exists(self::PreviousCardID, $params)) {
            $cardParams->previousCardID = $params[self::PreviousCardID];
        }
        if (array_key_exists(self::ExtraFields, $params)) {
            $cardParams->extraFields = $params[self::ExtraFields];
        }

        return $cardParams;
    }
673869
public static function createFromArray(array $array): self
    {
        if (empty($array['name'])) {
            throw InvalidFormatException::queryFormatNotValid($array);
        }

        return self::create(
            $array['name'],
            $array['field'] ?? 'uuid.type',
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            $array['filter_type'] ?? Filter::TYPE_FIELD,
            $array['subgroup'] ?? [],
            $array['sort'] ?? self::SORT_BY_COUNT_DESC,
            $array['limit'] ?? self::NO_LIMIT
        );
    }
1215264
public function createUserAction()
    {
        if(!$this->identity()) {
          return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }
      
        try {
            $user = new User;
            
            $form = $this->getUserFormHelper()->createUserForm($user, 'CreateUser');
            $request = $this->getRequest();
            if ($request->isPost()) {
                $form->setValidationGroup('username', 'email', 'firstName', 'lastName', 'password', 'passwordVerify', 'language', 'state', 'role', 'question', 'answer', 'csrf');
                $form->setData($request->getPost());
                if ($form->isValid()) {
                    $entityManager = $this->getEntityManager();
                    $user->setEmailConfirmed(false);
                    $user->setRegistrationDate(new \DateTime());
                    $user->setRegistrationToken(md5(uniqid(mt_rand(), true)));
                    $user->setPassword(UserCredentialsService::encryptPassword($user->getPassword()));
                    $entityManager->persist($user);
                    $entityManager->flush();
                    $this->flashMessenger()->addSuccessMessage($this->getTranslatorHelper()->translate('User created Successfully'));
                    return $this->redirect()->toRoute('user-admin');                                        
                }
            }        
        }
        catch (\Exception $e) {
            return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView(
                $this->getTranslatorHelper()->translate('Something went wrong during user creation! Please, try again later.'),
                $e,
                $this->getOptions()->getDisplayExceptions(),
                false
            );
        }
        
        $viewModel = new ViewModel(array('form' => $form));
        $viewModel->setTemplate('csn-user/admin/new-user-form');
        return $viewModel;
    }
823637
public function createUser($data) {
        $user = new User;

        $user->name       = $data['name'];
        $user->email      = $data['email'];
        $user->password   = bcrypt($data['password']);

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

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


        // two factor authorization
        // the front-end registrationdoes not set a value for this field,
        // but the admin does
        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'];



        // When the admin is adding a new user, use their user id
        // for the created_by and updated_by fields. When no
        // one is logged in during this user creation process, it
        // means that someone is initiating their own registration
        // via the front-end. In which case, use the user id 
        // specified in the auth config file.

        if (isset(Auth::user()->id)) {
            $user->created_by  = Auth::user()->id;
            $user->updated_by  = Auth::user()->id;
        } else {
            $user->created_by  = config('lasallecmsusermanagement.auth_user_id_for_created_by_for_frontend_user_registration');
            $user->updated_by  = config('lasallecmsusermanagement.auth_user_id_for_created_by_for_frontend_user_registration');
        }

        // INSERT!
        $saveWentOk = $user->save();

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

            return true;
        }

        return false;
    }
507720
protected function authorization(array $array)
    {
        $authorization = new Authorization($array);
        if ($array) {
            foreach ($array as $k => $v) {
                if (array_key_exists($k, $authorization) && (strlen($v))) {
                    $authorization->$k = $v;
                }
            }
        }
        return new \SoapVar($authorization, SOAP_ENC_OBJECT, self::SOAP_AUTHORIZATION, self::PAYLINE_NAMESPACE);
    }