Skip to content

Commit

Permalink
改进远程一对多关联
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jan 21, 2022
1 parent 6bd5000 commit c171243
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/model/relation/HasManyThrough.php
Expand Up @@ -258,8 +258,14 @@ protected function eagerlyWhere(array $where, string $key, array $subRelation =
$closure($this->getClosureType($closure));
}

$throughKey = $this->throughKey;

if ($this->baseQuery) {
$throughKey = Str::snake(class_basename($this->model)) . "." . $this->throughKey;
}

$list = $this->query
->where($this->throughKey, 'in', $keys)
->where($throughKey, 'in', $keys)
->cache($cache[0] ?? false, $cache[1] ?? null, $cache[2] ?? null)
->select();

Expand Down

0 comments on commit c171243

Please sign in to comment.