This commit is contained in:
thinkphp
2018-10-26 16:29:49 +08:00
parent b90b6a1ecb
commit 64ea8511cd

View File

@@ -365,9 +365,11 @@ class BelongsToMany extends Relation
*/
public function getRelationCountQuery($closure, &$name = null)
{
$return = call_user_func_array($closure, [ & $this->query]);
if ($return && is_string($return)) {
$name = $return;
if ($closure) {
$return = call_user_func_array($closure, [ & $this->query]);
if ($return && is_string($return)) {
$name = $return;
}
}
return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [