Check if the operation is update or create
@param $input
@return booelan $update update=true create=false
353758
protected function isUpdate($input)
    {
        return (isset($input[$this->id_field_name]) && ! empty($input[$this->id_field_name]) );
    }
1126986
public function validate($input): bool
    {
        return $this->less($this->minValue, $input)
            && $this->less($input, $this->maxValue);
    }
661556
public function prepare($input)
    {
        $form = $this->buildEmbeddedForm();

        return $form->setOriginal($this->original)->prepare($input);
    }
165024
protected function detectSpecialKey($input)
    {
        $specialKey = false;
        if (in_array(ord($input), [27, 127, 10])) {
            $specialKey = array_search(urlencode($input), $this->specialKeys);
        }

        return $specialKey ? $specialKey : null;
    }
684456
public function check($input)
    {
        if ($this->lazy) {
            $this->lazy = false;
            $this->parseDefinition();
        }
        $this->lastValue = $input;
        if (strlen($input) === 0 && $this->skipEmpty) {
            return true;
        }
        $constraint = $this->constraint;
        return $constraint($input, $this, $this->attrib, $this->dataFilter);
    }
1036802
public static function isBool($input) {
        if(is_bool($input)) {
            return $input; //Already a boolean
        }
        if(is_int($input) || is_float($input)) {
            return $input != 0;
        }
        $input = strtolower(self::isString($input));
        return in_array($input, array('active', 'true', 'yes', '1', 'on', 'y'), TRUE);
    }
279069
public static function onValidUpdate(&$input, $newErrors) {
		// Don't care about some errors, other fields should be updated.
		$found = 0;
		foreach( $input as $fieldname => $fieldvalue ) {
			if( in_array($fieldname, static::$fields) ) {
				$found++;
			}
		}
		if( $found ) {
			static::fillLogEvent($input, 'edit');
			static::fillLogEvent($input, 'update');
		}
		return $found ? true : false;
	}
87701
public function validate($input) {
        if (is_null($input)) {
            return false;
        }
        if (is_string($input)) {
            return trim($input) !== '';
        }
        if (!is_array($input)) {
            return true;
        }
        foreach ($input as $item) {
            if ($this->validate($item)) {
                return true;
            }
        }
        return false;
    }
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();
    }
1107013
public function modify($input)
    {
        foreach ($this->getModifiers() as $modifier) {
            $input = $modifier->modify($input);
        }

        return $input;
    }
549130
public function validate($input): bool
    {
        if (\is_string($input)) {
            $input = trim($input);
        }

        return !empty($input);
    }
1313910
protected function isUpdateNeeded(InputInterface $input, OutputInterface $output)
    {
        if ('@warning_time@' !== Tenside::WARNING_TIME) {
            $commandName = '';
            if ($name = $this->getCommandName($input)) {
                try {
                    $commandName = $this->find($name)->getName();
                } catch (\InvalidArgumentException $e) {
                    // Swallow the exception.
                }
            }
            if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
                if (time() > Tenside::WARNING_TIME) {
                    $output->writeln(
                        sprintf(
                            '<warning>Warning: This development build is over 30 days old. ' .
                            'It is recommended to update it by running "%s self-update" to get the latest version.' .
                            '</warning>',
                            $_SERVER['PHP_SELF']
                        )
                    );

                    return true;
                }
            }
        }

        return false;
    }
1082853
public function update( $id = false, $inputs = [] )
	{
		if( is_numeric($id) )
		{
			$update_inputs = [];
			$values = [];

			foreach( $inputs as $key => $value )
			{
				$update_inputs []= "`$key` = :$key";
				$values[":$key"] = $value;
			}

			$values[":id"] = $id;

			return $this->execute( "UPDATE `{$this->table}` SET " . implode(',',$update_inputs) . " WHERE `id` = :id" , $values );
		}
		return false;
	}
523120
public static function attempt($input)
    {
        $userModel = Config::get('user');
        $model = new $userModel();

        $count = 0;

        foreach ($input as $field => $value) {
            if ($field == '_') {
                unset($input[$field]);
            } else {
                $count++;
            }
            if ($count == 1) {
                $primary = $field;
            }
        }

        if (!empty($input)) {
            $user = $model->where($primary, $input[$primary])->first();

            if (! empty($user) && Hash::check($input['password'], $user->password)) {
                Session::set('user', $user->id);
                return true;
            }

            return false;
        }
    }
1064649
public function input($input): ProcessBuilder
    {
        if ($input === null) {
            $this->input = null;

            return $this;
        }

        if (is_resource($input)) {
            $this->input = $input;

            return $this;
        }

        if (is_scalar($input)) {
            $this->input = (string) $input;
        }

        return $this;
    }
232680
public function getUpdateOperation($input, $fields) {
		$operation = new UpdateTransactionOperation(static::getClass(), $input, $fields, $this);
		$operation->setSQLAdapter(static::getSQLAdapter());
		return $operation;
	}
1260270
public function create(array $input)
	{
    unset($input['_token']);

    $loggedUserId = $this->AuthenticationManager->getLoggedUserId();
    $organizationId = $this->AuthenticationManager->getCurrentUserOrganizationId();

    $input = eloquent_array_filter_for_insert($input);
		$input = array_add($input, 'organization_id', $organizationId);
    // $input['date'] = $this->Carbon->createFromFormat($this->Lang->get('form.phpShortDateFormat'), $input['date'])->format('Y-m-d');

    $this->DB->transaction(function() use ($input, $loggedUserId, $organizationId)
		{
      $VoucherType = $this->VoucherType->create($input);

      $Journal = $this->Journal->create(array('journalized_id' => $VoucherType->id, 'journalized_type' => $this->VoucherType->getTable(), 'user_id' => $loggedUserId, 'organization_id' => $organizationId));
      $this->Journal->attachDetail($Journal->id, array('note' => $this->Lang->get('decima-accounting::voucher-type-management.addedJournal', array('VoucherType' => $VoucherType->name)), $Journal));
    });

    return json_encode(array('success' => $this->Lang->get('form.defaultSuccessSaveMessage'), 'voucherTypes' => $this->getVoucherTypes()));
  }