Update a configuration. The provider will be marked as enabled. Response will be returned.

@param ConfigurationListener $listener
@param array $input
@return mixed
540677
public function update(ConfigurationListener $listener, array $input)
    {
        try {
            $this->providersRepository->update($input);
            $msg = trans('antares/two_factor_auth::configuration.responses.update.success');

            return $listener->updateSuccess($msg);
        } catch (Exception $e) {
            Log::emergency($e);

            $msg = trans('antares/two_factor_auth::configuration.responses.update.fail');
            return $listener->updateFailed($msg);
        }
    }
721865
protected static function mergeCommandOptionsIntoConfiguration(Configuration $config, InputExtendedInterface $input)
    {
        $configurationMapping = [
            // Database credentials
            'database-host' => 'Database.Host',
            'database-user' => 'Database.Username',
            'database-pass' => 'Database.Password',
            'database-port' => 'Database.Port',
            'database-name' => 'Database.Name',
            // SSH settings
            'ssh-key'       => 'SSH.KeyFile',
        ];

        foreach ($configurationMapping as $optionName => $configName) {
            if ($input->isOptionSet($optionName) === true) {
                $config->setConfigurationValue($configName, $input->getOption($optionName));

            // If the value is not set / available, set this to nothing
            } elseif (!$config->getConfigurationValue($configName)) {
                $config->setConfigurationValue($configName, null);
            }
        }

        return $config;
    }
938925
protected function ensureListener($listener): Listener
    {
        if (Assert::instanceOf($listener, '\\One\\Event\\Listener')) {
            return $listener;
        } elseif (Assert::instanceOf($listener, '\\Closure') || Assert::array($listener)) {
            return new Listener($listener);
        } elseif (Assert::string($listener)) {
            return Reflection::newInstance($listener);
        }

        throw new InvalidArgumentException(
            '`Listener` must be `array`, `Closure` or extends class `One\Event\Listener`'
        );
    }
223153
public function store($listener, array $input)
    {
        $validation = $this->validator->on('create')->with($input);

        if ($validation->fails()) {
            return $listener->storeValidationFailed($validation);
        }

        $role = $this->model;

        try {
            $this->saving($role, $input, 'create');
        } catch (Exception $e) {
            return $listener->storeFailed(['error' => $e->getMessage()]);
        }

        return $listener->storeSucceed($role);
    }
335233
public function update(array $input = [])
    {
        DB::beginTransaction();

        try {
            LaravelEvent::fire(static::$name.'.updating', $this);
            $this->beforeUpdate($input);
            $return = parent::update($input);
            $this->afterUpdate($input, $return);
            LaravelEvent::fire(static::$name.'.updated', $this);

            DB::commit();
        } catch (\Exception $e) {
            DB::rollBack();
            throw $e;
        }

        return $return;
    }
245434
public function enable(UserConfigurationListener $listener, User $user, AreaContract $area)
    {
        try {
            $userConfig = $this->getUserConfig($user, $area);

            $this->userConfigRepository->markAsEnabledById($userConfig->id);

            if ($this->isConfigured($area)) {
                $msg = trans('antares/two_factor_auth::configuration.responses.enable.success', ['area' => $area->getLabel()]);
                return $listener->afterConfiguration($area, $msg);
            }

            return $this->configure($listener, $area);
        } catch (Exception $e) {
            Log::emergency($e);

            $msg = trans('antares/two_factor_auth::configuration.responses.enable.fail', ['area' => $area->getLabel()]);

            return $listener->enableFailed($msg);
        }
    }
1073972
public function store(BannedEmailStoreListener $listener, array $input)
    {
        if (empty(array_get($input, 'expired_at'))) {
            $input['expired_at'] = null;
        }

        $bannedEmail = new BannedEmail();
        $bannedEmail->fill($input);

        $form = $this->presenter->form($bannedEmail);

        if (!$form->isValid()) {
            return $listener->createBannedEmailFailedValidation($form->getMessageBag());
        }
        try {
            $this->repository->store($bannedEmail);
            $this->bannedEmailsService->saveToFile();
            return $listener->storeBannedEmailSuccess($bannedEmail);
        } catch (Exception $e) {
            Log::critical($e->getMessage());
            return $listener->storeBannedEmailFailed(['error' => $e->getMessage()]);
        }
    }
867559
public function edit(Listener $listener)
    {
        $eloquent = Auth::user();
        $form = $this->presenter->password($eloquent);

        return $listener->showPasswordChanger(['eloquent' => $eloquent, 'form' => $form]);
    }
297427
public function createOrUpdate($key, array $input, array $queryParams = [])
    {
        $response = $this->client->put($this->uri($key), [
            RequestOptions::JSON => ['setting' => $input],
            'query' => $queryParams,
        ]);

        return $this->handleResponse($response);
    }
136535
public function edit(Listener $listener)
    {
        $user = Auth::user();

        $form = $this->presenter->profile($user, 'orchestra::account');

        $this->fireEvent('form', [$user, $form]);

        return $listener->showProfileChanger(['eloquent' => $user, 'form' => $form]);
    }
443409
public function update(Listener $listener, $id, array $input)
    {
        $input['slug'] = $this->generateUniqueSlug($input);
        $validation    = $this->validator->on('update')->bind(['id' => $id])->with($input);

        if ($validation->fails()) {
            return $listener->updateHasFailedValidation($id, $validation->getMessageBag());
        }

        $content = Eloquent::findOrFail($id);

        $listener->authorize('update', $content);

        $this->saving($content, $input);

        return $listener->updateHasSucceed($content, $input);
    }
897799
public function update(Listener $listener, array $input)
    {
        $user = Auth::user();

        if (! $this->validateCurrentUser($user, $input)) {
            return $listener->abortWhenUserMismatched();
        }

        $validation = $this->validator->on('changePassword')->with($input);

        if ($validation->fails()) {
            return $listener->updatePasswordFailedValidation($validation->getMessageBag());
        }

        if (! Hash::check($input['current_password'], $user->password)) {
            return $listener->verifyCurrentPasswordFailed();
        }

        try {
            $this->saving($user, $input);
        } catch (Exception $e) {
            return $listener->updatePasswordFailed(['error' => $e->getMessage()]);
        }

        return $listener->passwordUpdated();
    }
310030
public function update(TranslationListener $listener, $type)
    {
        $params      = Input::all();
        $first       = head(array_keys(array_get($params, 'name')));
        $translation = Translation::whereId($first)->with('language')->first();
        $code        = $translation->language->code;
        if ($this->translationRepository->updateTranslations($params, $type)) {

            return $listener->updateSuccessfull($type, $code);
        }
        return $listener->updateFailed($type, $code);
    }
11419
public function setListeners(array $listeners = [])
    {
        foreach ($listeners as $listener) {
            if (!isset($listener['event']) || !isset($listener['listener'])) {
                throw new InvalidConfigException('Both "event" and "listener" properties are required to attach a listener.');
            }

            if (is_string($listener['listener'])) {
                $listener['listener'] = $this->listenerFromClassName($listener['listener']);
            }

            $this->addListener($listener['event'], $listener['listener'], $listener['priority'] ?? self::P_NORMAL);
        }

        return $this;
    }
706606
public function update($id, $input)
    {
        $this->model = $this->model->query()->findOrFail($id);

        $this->model = $this->model->fill($input);

        $filteredInput = $this->runChecks('update', $this->model->toArray(), $this->model->getOriginal());

        if ($filteredInput) {
            $this->model->fill($filteredInput);
        }

        return $this->model->save();
    }
707889
public function update(SettingUpdateListener $listener, array $input)
    {
        $input = new Fluent($input);
        $form  = $this->presenter->form($input);
        if (!$form->isValid()) {
            return $listener->settingFailedValidation($form->getMessageBag());
        }
        $memory = $this->memory;
        $memory->put('site.mode', $input['mode']);
        $memory->finish();
        return $listener->settingHasUpdated();
    }
387512
public function edit(SettingUpdateListener $listener)
    {
        $memory = $this->memory;

        $eloquent = new Fluent([
            'mode' => $memory->get('site.mode', 'development')
        ]);

        $form = $this->presenter->form($eloquent);
        return $listener->showSettingChanger(compact('eloquent', 'form'));
    }