/** * @param $name * @param WithJoinEloquentBuilder $query * @return bool */ protected function inWith($name, WithJoinEloquentBuilder $query) { $eagerLoads = $this->modelItem->getWith(); foreach ($eagerLoads as $with) { if (strpos($name, $with) !== 0) { continue; } $relation = $this->instance->{$with}(); if ($query->isRelationSupported($relation)) { return true; } } return false; }