We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
orderBy('a.id','desc')是laravel排序的基本写法。 现在在文件src/Repositories/EloquentRepository.php第222行写到: $this->setOrderBy( $model, str_replace('.', '->', $column), $type, $cast); 将$column 原本的a.id 转换成了 a->id
在setOrderBy方法中: $isJsonColumn = Str::contains($column, '->');
if ($isJsonColumn) { $explodedCols = explode('->', $column); // json字段排序 $col = $this->wrapMySqlColumn(array_shift($explodedCols)); $parts = implode('.', $explodedCols); $column = "JSON_UNQUOTE(JSON_EXTRACT({$col}, '$.{$parts}'))"; } 这个$isJsonColumn就必然为true了 结果就是正常的ORDER BY A.id 变成了ORDER BY JSON_UNQUOTE(JSON_EXTRACT(a, '$.id')" 成功报错。 PS:想骂人但是忍了
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description:
orderBy('a.id','desc')是laravel排序的基本写法。
现在在文件src/Repositories/EloquentRepository.php第222行写到:
$this->setOrderBy(
$model,
str_replace('.', '->', $column),
$type,
$cast);
将$column 原本的a.id 转换成了 a->id
在setOrderBy方法中:
$isJsonColumn = Str::contains($column, '->');
if ($isJsonColumn) {
$explodedCols = explode('->', $column);
// json字段排序
$col = $this->wrapMySqlColumn(array_shift($explodedCols));
$parts = implode('.', $explodedCols);
$column = "JSON_UNQUOTE(JSON_EXTRACT({$col}, '$.{$parts}'))";
}
这个$isJsonColumn就必然为true了
结果就是正常的ORDER BY A.id 变成了ORDER BY JSON_UNQUOTE(JSON_EXTRACT(a, '$.id')"
成功报错。
PS:想骂人但是忍了
Steps To Reproduce:
The text was updated successfully, but these errors were encountered: