proceed further with beans
This commit is contained in:
		@@ -22,18 +22,19 @@ trait Conditionable
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function addCondition(string $col, string|Operator $operator, mixed $val, string $prefix): self {
 | 
			
		||||
        $this->schema->requireColumn($col);
 | 
			
		||||
        $this->schema->reqCol($col);
 | 
			
		||||
        $info = $this->schema->getCol($col);
 | 
			
		||||
 | 
			
		||||
        // Convert the operator string to a ConditionOperator enum if needed.
 | 
			
		||||
        if (is_string($operator))
 | 
			
		||||
            $operator = Operator::fromString($operator);
 | 
			
		||||
 | 
			
		||||
        $columnType = $this->schema->columnType($col);
 | 
			
		||||
        $castedValue = $columnType->dbCast($val);
 | 
			
		||||
        $type = $info->type;
 | 
			
		||||
        $castedVal = $type->dbCast($val);
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->conditions))
 | 
			
		||||
            $this->conditions[] = $prefix;
 | 
			
		||||
        $this->conditions[] = "$col " . $operator->toString() . " $castedValue";
 | 
			
		||||
        $this->conditions[] = "$col " . $operator->toString() . " $castedVal";
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user