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

View File

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