Skip to content

Commit

Permalink
修正column方法对json字段的支持
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Aug 30, 2024
1 parent df85867 commit e7d20dd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/db/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,17 @@ public function column(string | array $field, string $key = ''): array
if ($this->model) {
return array_map(function ($item) use ($field) {
if (is_array($item)) {
// JSON数据处理
if (!empty($this->options['json'])) {
$this->jsonModelResult($item);
}
return $this->model->newInstance($item)->toarray();
}
$array[$field] = $item;
// JSON数据处理
if (!empty($this->options['json'])) {
$this->jsonModelResult($array);
}
return $this->model->newInstance($array)->getAttr($field);
}, $result);
}
Expand Down

0 comments on commit e7d20dd

Please sign in to comment.