orm: custom where value in complex expresssion, fix string expression unescaping

This commit is contained in:
Yuri Kuznetsov
2024-04-21 14:37:40 +03:00
parent a07f6b032a
commit ca053b57c5
3 changed files with 42 additions and 4 deletions
@@ -1275,8 +1275,14 @@ abstract class BaseQueryComposer implements QueryComposer
$argument = $attribute;
if (Util::isArgumentString($argument)) {
$isSingleQuote = $argument[0] === "'";
$string = substr($argument, 1, -1);
$string = $isSingleQuote ?
str_replace("\\'", "'", $string) :
str_replace('\\"', '"', $string);
return $this->quote($string);
}
@@ -2884,6 +2890,10 @@ abstract class BaseQueryComposer implements QueryComposer
$right = $this->applyValueToCustomWhereClause($right, $value);
}
if (is_string($left) && str_ends_with($left, ':') && str_contains($left, '{value}')) {
$left = str_replace('{value}', Expression\Util::stringifyArgument($value), $left);
}
$modified[$left] = $right;
}