@param array|string $columns
@param string|null  $value

@return Unit[]
962409
public function findBy($columns, $value = null)
    {
        $this->loadAll();

        if (!is_array($columns)) {
            $columns = array($columns => $value);
        }

        $result = array();
        foreach ($this->allUnits as $u) {
            $status = true;
            foreach ($columns as $column => $value) {
                $unitValue = call_user_func(array($u, 'get'.ucfirst($column)));
                $status &= is_array($value) ? in_array($unitValue, $value) : $unitValue == $value;
            }
            if ($status) {
                $result[] = $u;
            }
        }

        return $result;
    }
800696
private function update($columns, $values)
    {
        $query = Query::table(static::$table);
        //
        for ($i = 0; $i < Table::count($columns); $i++) {
            $query = !empty($values[$i]) ? $query->set($columns[$i], $values[$i]) : $query->set($columns[$i], 'null', false);
        }
        //
        $query->where($this->_keyName, '=', $this->_keyValue)
        ->update();
        //
        return $query;
    }
1371186
protected function setEmptyNullablesToNull(array $values): array
	{
		$nullables = $this->getNullableColumns();

		foreach($values as $column => $value)
		{
			if($value === '' && in_array($column, $nullables))
			{
				$values[$column] = null;
			}
		}

		return $values;
	}
32560
private function transformColumns($columns)
    {
        return array_map(function ($column) {
            return [
                'Field' => $column->column_name,
                'Type' => $column->data_type,
                'Null' => $column->is_nullable,
                'Key' => $column->ordinal_position,
                'Default' => $column->column_default,
//                'Extra' => $column->Extra
            ];
        }, $columns);
    }
505727
public function findBy($attribute, $value, $columns = [])
    {
        try {
            return $this->findByOrFail($attribute, $value, $columns);
        } catch (ModelNotFoundException $e) {
            return false;
        }
    }
707084
public function setSerialized($column, $value)
  {
    unset($this->serialized[$column]);

    return $this->set($column, !empty($value) ? serialize($value) : null);
  }
1060188
function whereNot( $column, $value = null ) {

        $clone = clone $this;

        // conditions in key-value array
        if ( is_array( $column ) ) {

            foreach ( $column as $c => $params ) {

                $clone = $clone->whereNot( $c, $params );

            }

            return $clone;

        }

        $clone->where[] = $this->db->isNot( $column, $value );

        return $clone;

    }
254450
public function gte($column, $value = null)
    {
        return $this->where($column, $value, Cmp::GTE);
    }
123688
public function findAll($value): ?array
    {
        $founded = array_keys($this->items->toArray(), $value, true);

        if (0 === count($founded)) {
            return null;
        }

        return $founded;
    }
976396
public String[] buildColumnsAs(String[] columns, String value) {

		String[] values = new String[columns.length];
		for (int i = 0; i < columns.length; i++) {
			values[i] = value;
		}

		return buildColumnsAs(columns, values);
	}
457132
private function splitQueryValue(string $value): array
    {
        $data = \explode('=', $value, 2);
        if (!isset($data[1])) {
            $data[] = null;
        }

        return $data;
    }
1369175
public static function valueForDatabase(string $column, $value) {
		// if we find a serialization keyword
		if(strpos($column,'_array') !== false) {
			// encode the content as JSON, being it array, null, false, whatever
			$value = json_encode($value);
		}
		// if we are dealing with a date and the value is not empty or null
		elseif(
			(
				substr($column,-9,9) == '_datetime' || 
				substr($column,-5,5) == '_date' || 
				substr($column,-3,3) == '_at' || 
				substr($column,-3,3) == '_on'
			) && $value != '') {
			// if the date has a time with it
			if(
				substr_count($value, '/') == 2 && 
				substr_count($value, ':') == 1 && 
				substr_count($value, ' ') == 1
			) {
				// explode the date's elements
				list($date, $time) 			= explode(' ', $value);
				// explode the date's elements
				list($day, $month, $year) 	= explode('/', $date);
				// explode the time element
				list($hour, $minute) 		= explode(':', $time);
				// create a timestamp early in the morning
				$value = mktime($hour, $minute, 1, $month, $day, $year);
			}
			// if the date is alone (no time besides it)
			elseif(substr_count($value, '/') == 2) {
				// explode the date's elements
				list($day, $month, $year) = explode('/', $value);
				// create a timestamp early in the morning
				$value = mktime(0, 0, 1, $month, $day, $year);
			}
			// date format in unknown, and does not look like a timestamp
			elseif(!is_numeric($value)) {
				// we can't allow such weird data get into the _date column
				Throw new Exception('Query->secure() : Wrong data type for magic date field '.$column);
			}
		}
		// return the value (transformed or not)
		return $value;
	}
122070
protected function _setColumns($value)
    {
        $columnMap = [
            1 => 12,
            2 => 6,
            3 => 4,
            4 => 3,
            6 => 2,
            12 => 1,
        ];
        if (!in_array($value, [1, 2, 3, 4, 6, 12])) {
            throw new InvalidArgumentException('Valid columns value must be one of [1, 2, 3, 4, 6, 12]');
        }

        $this->set('columnClass', sprintf('col-md-%d', $columnMap[$value]));

        return $value;
    }
105353
protected function getDataByColumn($data, $columns)
    {
        if (is_string($columns)) {
            return array_get($data, $columns);
        }

        if (is_array($columns)) {
            $value = [];
            foreach ($columns as $name => $column) {
                if (!array_has($data, $column)) {
                    continue;
                }
                $value[$name] = array_get($data, $column);
            }

            return $value;
        }
    }
20306
public function transform($value)
    {
        if (null !== $value && !is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        if ('' === $value || null === $value) {
            return null;
        }

        return [$value];
    }
451957
function setColumns($columns) {
		$this->columns = array();

		if ($columns === null) {
			return $this;
		}

		if (is_string($columns)) {
			return $this->addColumn($columns);
		}

		foreach ($columns as $alias => &$column) {
			$this->addColumn($column, is_int($alias) ? null : $alias);
		}
		return $this;
	}
1016503
private function validateColumns($columns): array
    {
        foreach($columns as $e=>$r){
            $columns[$e] = $this->validateColumn($r);
        }
        return $columns;

    }