Merge branch 'master' of gitee.com:fastadminnet/framework

This commit is contained in:
Karson
2024-03-26 17:19:29 +08:00
15 changed files with 35 additions and 14 deletions

View File

@@ -164,7 +164,7 @@ class HasMany extends Relation
}
}
$localKey = $this->localKey ?: $this->parent->getPk();
return $this->query->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $localKey)->fetchSql()->count();
return $this->query->alias( 'count_table')->whereExp( 'count_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $localKey)->fetchSql()->count();
}
/**